Add header to all formats
See original GitHub issueHey @dbanksdesign, I am trying to get the style-dictionary to work with the design token spec idea outlined by the w3c community group: https://github.com/design-tokens/community-group/issues/1
Getting the tokens out works fine in a custom build file like this
const StyleDictionaryExtended = require('style-dictionary').extend(__dirname + '/config.json');
const {tokens, version, data} = require(__dirname + '/tokens/w3c-design-tokens.json')
console.log('Build started...');
console.log('\n==============================================');
// turning array into a style-dictionary compatible object
StyleDictionaryExtended.properties = tokens.reduce((acc, item) => ({
...acc, [item.name]: item
}), {})
However, I would love to add the version
and maybe some meta data from the data
constants to the header of every transformed output. It seems to be quite cumbersome to create a custom format with StyleDictionaryExtended.registerFormat
for every language (sass, json, ios, android) just to add a header.
So I was wondering, is there a way to add some content to the header for all files?
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
Insert a header or footer - Microsoft Support
Go to Insert > Header or Footer. Choose the header style you want to use. Tip: Some built-in header and footer designs include...
Read more >Office Q&A: Adding custom headers to Word's Headers gallery
In this article, we'll add a custom header to the Headers gallery by saving the custom content as a building block.
Read more >How to Insert Custom Headers and Footers in Microsoft Word
Use the Built-In Headers and Footers in Word · Go to the Header & Footer section of the Insert tab on the ribbon...
Read more >Excel header and footer: how to add, change and remove
To insert headers or footers on multiple worksheets at a time, select all target sheets, and then add a header or footer in...
Read more >Insert a header or footer in Microsoft Word - YouTube
Use headers and footers to add a title, date, or page numbers to every page in a document. Learn more at the Office...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dbanksdesign can’t we just do it the way we do everything else? Allow registration of formatHelpers / via extend?
Hey @dbanksdesign that sounds great. I wasn’t sure how long it will take until the release (as I know form my own project that OS is always quite a lot of work).
I would think allowing users to extend the
fileHeader
function could be a great way. Maybe by adding an array of lines (or a function that returns an array of lines) and those lines will be added to the header?E.g. in the build.js file
I don’t know if this is a stupid idea as I just quickly dove into the code. But it would be great if one could overwrite or extend the
fileHeader
once inbuild.js
and it would be used for all formats (without a need to overwrite all the formats).Does this make sense?