@skyscanner/bpk-token-migration

Utility for replacing Backpack tokens

Usage no npm install needed!

<script type="module">
  import skyscannerBpkTokenMigration from 'https://cdn.skypack.dev/@skyscanner/bpk-token-migration';
</script>

README

bpk-token-migration

npm version

Replaces all instances of Backpack tokens in .scss files from the old variable-based format, to the new function-based format.

Example

Before

.my-component {
  margin: $bpk-spacing-sm;
  padding: $bpk-spacing-md $bpk-spacing-base;
}

After

.my-component {
  margin: bpk-spacing-sm();
  padding: bpk-spacing-md() bpk-spacing-base();
}

Usage

# Run on the current directory
npx @skyscanner/bpk-token-migration

# Run on a specific directory
npx @skyscanner/bpk-token-migration src/packages

Scans directories recursively, looking for all files ending in .scss. Your .gitignore file is respected, no files listed in there will be included.

Contributing

# Run the code locally
node index.js directory/to/test/on

# Run tests
npm test