Skip to content

Commit 5095ac4

Browse files
didoochazzmoney
authored andcommitted
Better examples (#164)
* changed folder structure * removed table in Readme of Basic example (not clear and probably also some cells were wrong) * small update for the Basic example to make it more clear how aliases are referenced * renamed the “npm” example to “npm module” * updated “npm” example to use the same config and properties as the “basic” example * removed license (no sense here) and updated package.json * updated the s3 example making it more similar to other examples and adding some more assets to be uploaded and linked/embedded in tokens * updated logo in main Readme in example folder * updated the Readme for the S3 example * tried to re-organise the “react” folder in two separate folders the web app doesn’t compile * removed spaces from “example” sub-folder * renamed “example” folder to “examples” * removed numbers from “examples” sub-folder names * removed space in sub-folder names * added advanced example on how to use a watcher to auto-rebuild see: #171 * small update to Readme for “auto-rebuild-watcher” * added advanced example on how to have a multi-platform multi-brand suite * added advanced example on how to use custom templates * fixed “watch” npm script declaration * moved packages under “devDependencies” for “custom templates” package * added a comment in an example of the lodash templating syntax * remove invisible characters from Readme * added “clean” npm script call where missing in examples package.json * added .gitignore file where was missing in examples folder * updated the config file for the “npm module” example * added a comment to explain better how the “formatter” function works * updated the “init” command to expose only the possible/meaningful options + updated documentation for the “examples” page * added comment about collecting more examples * updated the Readme for the “examples” folder * updated “version.js” script as per Danny suggestion * added advanced example on how to use custom transforms * updated basic example to use “format” instead of “template” to avoid the alert in console * added advanced example about referencing/aliasing * updated example to show reference to an “object-like” value * removed the advanced examples for react and react native * added a “create react app” example (with Sass) * better config for S3 example * simplified the example for “S3” * re-introduced android + ios in S3 example * added a “assets-base64-embed” example * finalised the “assets-base64-embed” example * updated Readme for “npm” example + fixed the “prepublishOnly” script option (previous one was deprecated) * removed the “create-react-app-sass” example (I’ll add it later in a separate ticket) * updated the documentation
1 parent d80cbb3 commit 5095ac4

File tree

427 files changed

+3690
-5575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

427 files changed

+3690
-5575
lines changed

bin/style-dictionary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ program
3838
.command('init <type>')
3939
.description('Generates a starter style dictionary')
4040
.action(function(type){
41-
var types = ['s3', 'npm', 'complete', 'basic'];
41+
var types = ['basic', 'complete'];
4242
if (types.indexOf(type) < 0) {
4343
console.error('Please supply 1 type of project from: ' + types.join(', '));
4444
process.exit(1);

docs/examples.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
# Examples
22

3-
To get you started, there are some example packages included that you can use. You can take a look at the code on Github or you
4-
can use the CLI included to generate a new package using these examples. Here is how you can do that:
3+
To get you started, there are some example packages included that you can use. You can [take a look at the code on Github](https://github.com/amzn/style-dictionary/tree/master/example/) or you can use the CLI included to generate a new package using some of these examples. Here is how you can do that:
4+
55
```bash
6-
$ mkdir MyStyleD
7-
$ cd MyStyleD
6+
$ mkdir MyFolder
7+
$ cd MyFolder
88
$ style-dictionary init [example]
99
```
10-
Where `[example]` is one of: `basic`, `complete`, `npm`, `s3`
10+
11+
Where `[example]` is one of: `basic`, `complete`.
1112

1213
## Basic
1314
[View on Github](https://github.com/amzn/style-dictionary/tree/master/example/basic)
1415

15-
This example code is bare-bones to show you what this framework can do. Use this if you want to play around with what the Style Dictionary
16-
can do.
16+
This example code is bare-bones to show you what this framework can do. Use this if you want to play around with what the Style Dictionary can do.
1717

1818

1919
## Complete
2020
[View on Github](https://github.com/amzn/style-dictionary/tree/master/example/complete)
2121

22-
This is a more complete package and should have everything you need to get started. This package can be consumed as a Cocoapod on iOS,
23-
as a node module for web, and as a local library for Android.
22+
This is a more complete package and should have everything you need to get started. This package can be consumed as a Cocoapod on iOS, as a node module for web, and as a local library for Android.
2423

25-
## npm
26-
[View on Github](https://github.com/amzn/style-dictionary/tree/master/example/npm)
24+
## Advanced
25+
[View the folder](https://github.com/amzn/style-dictionary/tree/master/example/advanced)
2726

28-
This example shows how to set up a style dictionary as an npm module, either to publish to a local npm service or to publish externally.
27+
If you want to look at more advanced examples of possible applications and customisations of Style Dictionary, the `examples/advanced` folder on GitHub contains these extra folders:
2928

30-
When you publish this npm module, the prepublish hook will run, calling the style dictionary build system to create the necessary files. You can also just run `npm run build` to generate the files to see what it is creating.
29+
* [**assets-base64-embed**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/assets-base64-embed) shows how it's possible to embed and distribute assets – like images, icons and fonts – directly as design tokens.
30+
* [**auto-rebuild-watcher**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/auto-rebuild-watcher) shows how to setup a "watcher" that auto-rebuilds the tokens every time there is a change in the properties.
31+
* [**custom-templates**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/custom-templates/custom-templates) shows how to use "custom" templates to generate design tokens files with custom formats, useful when you need to distribute your design tokens and integrate them with custom pipelines or scripts.
32+
* [**custom-transforms**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/custom-templates/custom-transforms) shows how to use custom tranforms (and transformGroups) to apply custom "tranformations" to the properties when converted to design tokens.
33+
* [**multi-brand-multi-platform**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/multi-brand-multi-platform) shows how to set up Style Dictionary to support a multi-brand (for brand theming) and multi-platform (web, iOS, Android) solution, with property values depending on brand and plaforms.
34+
* [**npm-module**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/npm-module) shows how to set up a style dictionary as an npm module, either to publish to a local npm service or to publish externally.
35+
* [**s3**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/s3) shows how to set up a style dictionary to build files for different platforms (web, iOS, Android) and upload those build artifacts, together with a group of assets, to an S3 bucket.
36+
* [**referencing_aliasing**](https://github.com/amzn/style-dictionary/tree/master/example/advanced/referencing_aliasing) shows how to use referencing (or "aliasing") to reference a value -or an attribute– of a property and assign it to the value –or attribute– of another property.
3137

32-
## s3
33-
[View on Github](https://github.com/amzn/style-dictionary/tree/master/example/s3)
3438

35-
One way to use the style dictionary framework is to build files for each platform and upload those build artifacts to an s3 bucket. The platforms can pull these files down during their build process.
39+
---
3640

37-
----
41+
#### Do you think an example is missing?<br/>Do you want to see another example added to the project?<br/>Do you have a working example that we can add to the list?
3842

39-
> More coming soon...
43+
Fantastic! Let us know by [filing an issue](https://github.com/amzn/style-dictionary/issues) or sending us an email: style-dictionary@amazon.com.

example/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

example/basic/properties/color/font.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

example/npm/LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

example/npm/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)