Skip to content

Commit

Permalink
fixing didoos issues. dropping number of error messages sent. fixing …
Browse files Browse the repository at this point in the history
…bug with handling config that still contains template
  • Loading branch information
Charles Dorner committed Oct 5, 2018
1 parent bae7eb8 commit 19a1b49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ You can create custom formats using the [`registerFormat`](api.md#registerformat

A formatter is just a simple function and created easily with most templating engines. Templates are useful if there is a lot of boilerplate code to insert (e.g. ObjectiveC files). If the output consists of just the values (e.g. a flat SCSS variables file), writing a formatter function directly may be easier.

Any templating language can work as there is a node module for it. All you need to do is register a custom format which calls your template and returns a string.
Any templating language can work as there is a node module for it. All you need to do is register a format that calls your template and returns a string.

Here is a quick example for Lodash.
Here is a quick example where someone Lodash.

```js
const StyleDictionary = require('style-dictionary').extend('config.json');
const _ = require('lodash');

const template = _.template( fs.readFileSync('templates/MyTemplate.template') );
const template = _.template( fs.readFileSync('templates/sassMap.template') );

styleDictionary.registerFormat({
name: 'my/format',
name: 'sass/map',

This comment has been minimized.

Copy link
@didoo

didoo Oct 5, 2018

Contributor

Ah I understand your comment now! No, "my/format" is much clearer (is a custom format, "my" format).
What I meant is that in the previous code, the buildPlatform was to be removed: it was not clear how the code was going from the declaration/registration to the actual build (the format in that case is declared but not showing how/where it's used. Do you see what I mean? Sorry for the confusion.

formatter: template
});

Expand Down
2 changes: 1 addition & 1 deletion docs/templates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Templates

Templates are deprecated in favor of [Formats](formats.md) and will be removed in Style Dictionary 3.0. If you want to create a custom template, create a [Format that uses templating](formats.md).
Templates are deprecated in favor of [Formats](formats.md) and will be removed in the future. If you want to create a custom template, create a [Format that uses templating](formats.md#using-a-template-templating-engine-to-create-a-format).

>*__Why are Templates being deprecated in favor of Formats?__*
Expand Down
2 changes: 1 addition & 1 deletion example/complete/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"buildPath": "android/styledictionary/src/main/res/values/",
"files": [{
"destination": "style_dictionary_colors.xml",
"format": "android/colors"
"template": "android/colors"
},{
"destination": "style_dictionary_font_dimens.xml",
"format": "android/fontDimens"
Expand Down

0 comments on commit 19a1b49

Please sign in to comment.