Skip to content

Commit

Permalink
Merge pull request #1356 from julien-deramond/main-jd-fix-failed-link…
Browse files Browse the repository at this point in the history
…s-validation

Docs: Fix dead links and invalid hashes
  • Loading branch information
jorenbroekema authored Oct 14, 2024
2 parents 5974ad5 + 7489fce commit 22b803b
Show file tree
Hide file tree
Showing 13 changed files with 210 additions and 151 deletions.
10 changes: 5 additions & 5 deletions docs/src/content/docs/info/package_structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Here is a basic example of what a Style Dictionary package looks like.

</FileTree>

| Name | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config.json` | This is where the [configuration](/reference/config) for the style dictionary lives, where you define what happens when Style Dictionary runs |
| design token files | [Design tokens](/references/info/tokens) are saved as a collection of JSON or JS module files. You can put them wherever you like - the path to them should be in the `source` attribute on your `config.json` file. |
| assets (optional) | Assets can be included in your style dictionary package, allowing you to keep them in your style dictionary as a single source of truth. |
| Name | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config.json` | This is where the [configuration](/reference/config) for the style dictionary lives, where you define what happens when Style Dictionary runs |
| design token files | [Design tokens](/info/tokens) are saved as a collection of JSON or JS module files. You can put them wherever you like - the path to them should be in the `source` attribute on your `config.json` file. |
| assets (optional) | Assets can be included in your style dictionary package, allowing you to keep them in your style dictionary as a single source of truth. |

## Assets

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/info/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,4 @@ The CTI is implicit in the structure, the category is 'size' and the type is 'fo

Structuring design tokens in this manner gives us consistent naming and accessing of these tokens. You don't need to remember if it is `button_color_error` or `error_button_color`, it is `color_background_button_error`!

You can organize and name your design tokens however you want, **there are no restrictions**. But there are a good amount of helpers if you do use this structure, like the [`'attribute/cti'` transform](/reference/hooks/transforms#attributecti) which adds attributes to the design token of its CTI based on the path in the object. These attributes can then be used in other transforms to get some info about the token, or to [filter tokens using filters](/reference/hooks/filters).
You can organize and name your design tokens however you want, **there are no restrictions**. But there are a good amount of helpers if you do use this structure, like the [`'attribute/cti'` transform](/reference/hooks/transforms/predefined#attributecti) which adds attributes to the design token of its CTI based on the path in the object. These attributes can then be used in other transforms to get some info about the token, or to [filter tokens using filters](/reference/hooks/filters).
24 changes: 12 additions & 12 deletions docs/src/content/docs/reference/Hooks/Formats/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You use formats in your config file under `platforms` > `[Platform]` > `files` >
}
```

There is an extensive (but not exhaustive) list of [built-in formats](predefined) available in Style Dictionary.
There is an extensive (but not exhaustive) list of [built-in formats](/reference/hooks/formats/predefined) available in Style Dictionary.

## Format configuration

Expand All @@ -55,16 +55,16 @@ Formats can take configuration to make them more flexible. This allows you to re
}
```

In this example we are adding the `mapName` configuration to the `scss/map-deep` format. This will change the name of the SCSS map in the output. Not all formats have the configuration options; format configuration is defined by the format itself. To see the configuration options of a format, take a look at the documentation of the [specific format](predefined).
In this example we are adding the `mapName` configuration to the `scss/map-deep` format. This will change the name of the SCSS map in the output. Not all formats have the configuration options; format configuration is defined by the format itself. To see the configuration options of a format, take a look at the documentation of the [specific format](/reference/hooks/formats/predefined).

## Filtering tokens

A special file configuration is [`filter`](/reference/hooks/filter), which will filter the tokens before they get to the format.
A special file configuration is [`filter`](/reference/hooks/filters), which will filter the tokens before they get to the format.
This allows you to re-use the same format to generate multiple files with different sets of tokens.
Filtering tokens works by adding a `filter` attribute on the file object, where `filter` is:

- An object which gets passed to [Lodash's filter method](https://lodash.com/docs/4.17.14#filter).
- A string that references the name of a registered [`filter`](/reference/hooks/filter), using the [`registerFilter`](/reference/api#registerfilter) method
- A string that references the name of a registered [`filter`](/reference/hooks/filters), using the [`registerFilter`](/reference/api#registerfilter) method
- A function that takes a token and returns a boolean if the token should be included (true) or excluded (false). **This is only available if you are defining your configuration in Javascript.**

```javascript
Expand Down Expand Up @@ -170,13 +170,13 @@ export default {

Not all formats use the `outputReferences` option because that file format might not support it (like JSON for example). The current list of formats that handle `outputReferences`:

- [css/variables](predefined/#cssvariables)
- [scss/variables](predefined/#scssvariables)
- [less/variables](predefined/#lessvariables)
- [android/resources](predefined/#androidresources)
- [compose/object](predefined/#composeobject)
- [ios-swift/class.swift](predefined/#ios-swiftclassswift)
- [flutter/class.dart](predefined/#flutterclassdart)
- [css/variables](/reference/hooks/formats/predefined/#cssvariables)
- [scss/variables](/reference/hooks/formats/predefined/#scssvariables)
- [less/variables](/reference/hooks/formats/predefined/#lessvariables)
- [android/resources](/reference/hooks/formats/predefined/#androidresources)
- [compose/object](/reference/hooks/formats/predefined/#composeobject)
- [ios-swift/class.swift](/reference/hooks/formats/predefined/#ios-swiftclassswift)
- [flutter/class.dart](/reference/hooks/formats/predefined/#flutterclassdart)

You can create custom formats that output references as well. See the [Custom format with output references](#custom-format-with-output-references) section.

Expand Down Expand Up @@ -205,7 +205,7 @@ By default Style Dictionary adds a file header comment in the top of files built

You can remove these comments with the option: `showFileHeader: false` if you do not want them in your generated files. You can also create your own file header or extend the default one. This could be useful if you want to put a version number or hash of the source files rather than a timestamp.

Custom file headers can be added the same way you would add a custom format, either by using the [`registerFileHeader`](/reference/api#registerfileheader) function or adding the [`fileHeader`](/reference/hooks/file-headers) object directly in the Style Dictionary [configuration](/reference/config). Your custom file header can be used in built-in formats as well as custom formats. To use a custom file header in a custom format see the [`fileHeader`](/reference/hooks/formats#fileheader) format helper method.
Custom file headers can be added the same way you would add a custom format, either by using the [`registerFileHeader`](/reference/api#registerfileheader) function or adding the [`fileHeader`](/reference/hooks/file-headers) object directly in the Style Dictionary [configuration](/reference/config). Your custom file header can be used in built-in formats as well as custom formats. To use a custom file header in a custom format see the [`fileHeader`](/reference/hooks/file-headers) format helper method.

```js title="build-tokens.js"
import StyleDictionary from 'style-dictionary';
Expand Down
Loading

0 comments on commit 22b803b

Please sign in to comment.