changes code examples in the tutorial to align with the currently generated file
This commit is contained in:
parent
98dcb5301b
commit
ba4b77cb42
4 changed files with 47 additions and 15 deletions
|
@ -16,8 +16,8 @@ So let's add it as a required measurement.
|
||||||
|
|
||||||
## Adding required measurements
|
## Adding required measurements
|
||||||
|
|
||||||
In our `bib.mjs` file, on the `bib` object, we'll add a new key called
|
In our `bib.mjs` file, on the `bib` object, there is a key called
|
||||||
`measurements` that will hold a list (an array) of all required measurements
|
`measurements` (line 121) that will hold a list (an array) of all required measurements
|
||||||
for this part.
|
for this part.
|
||||||
|
|
||||||
We are going to use *the official name* of the measurement. For head
|
We are going to use *the official name* of the measurement. For head
|
||||||
|
@ -31,10 +31,19 @@ function draftBib({ part }) {
|
||||||
|
|
||||||
export const bib = {
|
export const bib = {
|
||||||
name: 'tutorial.bib',
|
name: 'tutorial.bib',
|
||||||
draft: draftBib,
|
draft: draftBib,[],
|
||||||
// highlight-start
|
from: false,
|
||||||
|
hide: {
|
||||||
|
self: false,
|
||||||
|
from: false,
|
||||||
|
after: false
|
||||||
|
},
|
||||||
|
options: {},
|
||||||
|
// start-highlight
|
||||||
measurements: ['head'],
|
measurements: ['head'],
|
||||||
// highlight-end
|
// end-highlight
|
||||||
|
optionalMeasurements: [],
|
||||||
|
plugins: []
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -29,15 +29,25 @@ function draftBib({ part }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const bib = {
|
export const bib = {
|
||||||
|
|
||||||
name: 'tutorial.bib',
|
name: 'tutorial.bib',
|
||||||
draft: draftBib,
|
draft: draftBib,[],
|
||||||
measurements: ['head'],
|
from: false,
|
||||||
|
hide: {
|
||||||
|
self: false,
|
||||||
|
from: false,
|
||||||
|
after: false
|
||||||
|
},
|
||||||
// highlight-start
|
// highlight-start
|
||||||
options: {
|
options: {
|
||||||
neckRatio: { pct: 80, min: 70, max: 90, menu: 'fit' },
|
neckRatio: { pct: 80, min: 70, max: 90, menu: 'fit' },
|
||||||
},
|
},
|
||||||
// highlight-end
|
// highlight-end
|
||||||
|
measurements: [],
|
||||||
|
optionalMeasurements: [],
|
||||||
|
plugins: []
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Can you guess what it means?
|
Can you guess what it means?
|
||||||
|
|
|
@ -7,7 +7,8 @@ Time to turn our attention to the draft method of our part.
|
||||||
Inside our `design/src/bib.js` file, this is what it currently looks like:
|
Inside our `design/src/bib.js` file, this is what it currently looks like:
|
||||||
|
|
||||||
```design/src/bib.mjs
|
```design/src/bib.mjs
|
||||||
function draftBib({ part }) {
|
function draftBib({ part
|
||||||
|
}) {
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,17 +17,30 @@ and approachable code base.
|
||||||
The previous step has already set everything up for us. Our design's main file
|
The previous step has already set everything up for us. Our design's main file
|
||||||
lives in `design/src/index.mjs`, and our part lives in `design/src/bib.mjs`.
|
lives in `design/src/index.mjs`, and our part lives in `design/src/bib.mjs`.
|
||||||
|
|
||||||
This `bib.mjs` is where we'll do all our work. It currently looks like this:
|
This `bib.mjs` is where we'll do all our work. The file includes a basic guide on how to use it. We removed it for clarity in our example. It currently looks like this:
|
||||||
|
|
||||||
```design/src/bib.mjs
|
```design/src/bib.mjs
|
||||||
function draftBib({ part }) {
|
function draftBib ({
|
||||||
|
part, // Your draft method must return this
|
||||||
|
})
|
||||||
|
{
|
||||||
|
// Work your magic here
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
export const bib = {
|
export const bib = {
|
||||||
|
|
||||||
name: 'tutorial.bib',
|
name: 'tutorial.bib',
|
||||||
draft: draftBib,
|
draft: draftBib,[],
|
||||||
|
from: false,
|
||||||
|
hide: {
|
||||||
|
self: false,
|
||||||
|
from: false,
|
||||||
|
after: false
|
||||||
|
},
|
||||||
|
options: {},
|
||||||
|
measurements: [],
|
||||||
|
optionalMeasurements: [],
|
||||||
|
plugins: []
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -117,8 +130,7 @@ const Pattern = new Design({
|
||||||
* typically add a name and version here
|
* typically add a name and version here
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
version: "0.0.1",
|
name: "Tutorial",
|
||||||
name: "Tutorial",
|
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
* This `parts` key is the most important thing
|
* This `parts` key is the most important thing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue