Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Add support for .hbs templates #176

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"**/.git": true,
"**/node_modules": true,
"{build,dist-modern,dist}/": true
}
},
"html.format.indentHandlebars": true
}
9 changes: 9 additions & 0 deletions formats/polaris.custom-properties.css.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:root {
{{#each props as |prop|}}
{{#if prop.comment}}
{{{trimLeft (indent (comment (trim prop.comment)))}}}
{{/if}}
--p-{{kebabcase prop.name}}: {{#eq prop.type "string"}}"{{/eq}}{{{prop.value}}}{{#eq prop.type
"string"}}"{{/eq}};
{{/each}}
}
8 changes: 0 additions & 8 deletions formats/polaris.custom-properties.css.js

This file was deleted.

5 changes: 4 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const fs = require('fs');

const gulp = require('gulp');
const gulpLoadPlugins = require('gulp-load-plugins');
const theo = require('theo');
Expand Down Expand Up @@ -29,9 +31,10 @@ theo.registerTransform('web/js', ['color/rgb', 'timing/ms-unitless']);
theo.registerFormat('android.xml', require('./formats/android.xml.js'));
theo.registerFormat('ios.json', require('./formats/ios.json.js'));
theo.registerFormat('figma.json', require('./formats/figma.json.js'));

theo.registerFormat(
'polaris.custom-properties.css',
require('./formats/polaris.custom-properties.css.js'),
fs.readFileSync('./formats/polaris.custom-properties.css.hbs', 'utf8'),
);

theo.registerFormat('light.yml', tokenify('light'));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build:ts": "tsc -p tsconfig.build.json",
"build:gulp": "gulp",
"postbuild": "yarn run format",
"format": "prettier './dist-modern/**/*.{js,json}' --write && prettier './dist-modern/**/*.ts' --write --parser typescript",
"format": "prettier './dist-modern/**/*.{js,json,css}' --write && prettier './dist-modern/**/*.ts' --write --parser typescript",
"type-check": "sewing-kit type-check",
"lint": "sewing-kit lint"
},
Expand Down