Skip to content

Commit

Permalink
chore: re-add custom file header to include tokens docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz committed Sep 3, 2024
1 parent ec15f2a commit 8234010
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
15 changes: 3 additions & 12 deletions lib/build-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ async function buildTokensCommand(commandArgs) {
prefix: 'pgn',
// NOTE: buildPath must end with a slash
buildPath: buildDir.slice(-1) === '/' ? buildDir : `${buildDir}/`,
options: {
fileHeader: 'customFileHeader',
},
files: [
{
format: 'css/custom-variables',
destination: 'core/variables.css',
filter: hasSourceTokensOnly ? 'isSource' : undefined,
options: {
outputReferences,
formatting: {
fileHeaderTimestamp: true,
},
},
},
{
Expand All @@ -79,9 +79,6 @@ async function buildTokensCommand(commandArgs) {
filter: hasSourceTokensOnly ? 'isSource' : undefined,
options: {
outputReferences,
formatting: {
fileHeaderTimestamp: true,
},
},
},
],
Expand Down Expand Up @@ -124,9 +121,6 @@ async function buildTokensCommand(commandArgs) {
: `isThemeVariant.${themeVariant}`,
options: {
outputReferences,
formatting: {
fileHeaderTimestamp: true,
},
},
},
{
Expand All @@ -135,9 +129,6 @@ async function buildTokensCommand(commandArgs) {
filter: hasSourceTokensOnly ? 'isSource' : undefined,
options: {
outputReferences,
formatting: {
fileHeaderTimestamp: true,
},
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions styles/css/core/custom-media-breakpoints.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly, this file was auto-generated.
* Generated on Tue, 03 Sep 2024 13:46:25 GMT
* Do not edit directly, this file was auto-generated. while transforming design tokens.
* See <root>/tokens/README.md for more details.
*/

@custom-media --pgn-size-breakpoint-min-width-xs (min-width: 0);
Expand Down
4 changes: 2 additions & 2 deletions styles/css/core/variables.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly, this file was auto-generated.
* Generated on Tue, 03 Sep 2024 13:46:25 GMT
* Do not edit directly, this file was auto-generated. while transforming design tokens.
* See <root>/tokens/README.md for more details.
*/

:root {
Expand Down
4 changes: 2 additions & 2 deletions styles/css/themes/light/utility-classes.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly, this file was auto-generated.
* Generated on Tue, 03 Sep 2024 13:46:26 GMT
* Do not edit directly, this file was auto-generated. while transforming design tokens.
* See <root>/tokens/README.md for more details.
*/

.bg-accent-a {
Expand Down
4 changes: 2 additions & 2 deletions styles/css/themes/light/variables.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly, this file was auto-generated.
* Generated on Tue, 03 Sep 2024 13:46:26 GMT
* Do not edit directly, this file was auto-generated. while transforming design tokens.
* See <root>/tokens/README.md for more details.
*/

:root {
Expand Down
11 changes: 11 additions & 0 deletions tokens/style-dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,17 @@ const initializeStyleDictionary = async ({ themes }) => {
parser: ({ contents }) => toml.load(contents),
});

/**
* Registers a custom fileHeader.
*/
StyleDictionary.registerFileHeader({
name: 'customFileHeader',
fileHeader: (defaultMessage) => [
`${defaultMessage} while transforming design tokens.`,
'See <root>/tokens/README.md for more details.',
],
});

return StyleDictionary;
};

Expand Down

0 comments on commit 8234010

Please sign in to comment.