feat: Flat import of markdown repo
This is a flat (without history) import of (some of) the content from our markdown module. We've imported this without history because the repo contains our blog posts and showcases posts content prior to porting them to strapi. Since this contains many images, it would balloon the size of this repo to import the full history. Instead, please refer to the history of the (archived) markdown repo at: https://github.com/freesewing/markdown
This commit is contained in:
parent
1671a896b5
commit
b34a2ee2ed
6132 changed files with 244167 additions and 0 deletions
56
markdown/dev/howtos/code/shared-dimensions/en.md
Normal file
56
markdown/dev/howtos/code/shared-dimensions/en.md
Normal file
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
title: Share dimensions between pattern parts
|
||||
for: developers
|
||||
about: Shows how to share dimensions between similar pattern parts
|
||||
---
|
||||
|
||||
<Note>
|
||||
|
||||
##### See this example in our source code
|
||||
|
||||
- [packages/aaron/src/shared.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/shared.js)
|
||||
- [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/src/front.js#L160)
|
||||
|
||||
</Note>
|
||||
|
||||
|
||||
When you have different pattern parts that look similar -- like the front
|
||||
and back of a garment -- you may find that there's a lot of dimensions
|
||||
shared between them.
|
||||
|
||||
The example below is from Aaron where dimensions are shared between
|
||||
the back and front part.
|
||||
|
||||
Aaron has a file called `shared.js` that looks like this:
|
||||
|
||||
```js
|
||||
export function dimensions(macro, points, sa) {
|
||||
macro('hd', {
|
||||
from: points.cfHem,
|
||||
to: points.hem,
|
||||
y: points.hem.y + sa * 2.5 + 15
|
||||
})
|
||||
// more dimensions here
|
||||
}
|
||||
```
|
||||
|
||||
In both `front.js` and `back.js` we use this code to add these shared dimensions:
|
||||
|
||||
```js
|
||||
import { dimensions } from './shared'
|
||||
|
||||
// ...
|
||||
|
||||
if (paperless) {
|
||||
dimensions(macro, points, sa)
|
||||
// ... specific dimensions
|
||||
}
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
Since our shared dimension method is a so-called _named export_ we need to
|
||||
import it with the syntax you see above.
|
||||
|
||||
</Note>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue