Command line tool for switching .scss files to use the V2 version of Backpack tokens
It scans directories recursively, looking for all files ending in .scss
, then does one of three things depending on which script name you pass in:
Replaces all instances of tokens in .scss
files from the old variable-based format, to the new function-based format.
npx @skyscanner/bpk-token-migration replace-tokens-with-functions [directory-name]
.my-component {
margin: $bpk-spacing-sm;
padding: $bpk-spacing-md $bpk-spacing-base;
}
.my-component {
margin: bpk-spacing-sm();
padding: bpk-spacing-md() bpk-spacing-base();
}
Adds $bpk-spacing-v2: false
to the beginning of every .scss
file. If the line is already present, it will be replaced.
Setting this variable disables V2 spacing for any usages of the spacing functions (bpk-spacing-sm()
etc).
npx @skyscanner/bpk-token-migration disable-v2-spacing [directory-name]
.my-component {
margin: bpk-spacing-sm();
padding: bpk-spacing-md() bpk-spacing-base();
}
$bpk-spacing-v2: false;
.my-component {
margin: bpk-spacing-sm();
padding: bpk-spacing-md() bpk-spacing-base();
}
Adds $bpk-spacing-v2: true
to the beginning of every .scss
file. If the line is already present, it will be replaced.
Setting this variable disables V2 spacing for any usages of the spacing functions (bpk-spacing-sm()
etc).
npx @skyscanner/bpk-token-migration enable-v2-spacing [directory-name]
.my-component {
margin: bpk-spacing-sm();
padding: bpk-spacing-md() bpk-spacing-base();
}
$bpk-spacing-v2: true;
.my-component {
margin: bpk-spacing-sm();
padding: bpk-spacing-md() bpk-spacing-base();
}
# Run the code locally
node index.js directory/to/test/on
# Run tests
npm test