scss-typer
v1.0.7
Published
A node script/package to automatically generate TypeScript type definitions for all your .module.scss files
Downloads
9
Readme
SCSS-Typer
A node script/package to automatically generate TypeScript type definitions for all your .module.scss files.
Usage
npx scss-typer /path/to/file/or/directory [-a|--all]
Just run the script using npx (or install it globally) and run it on a chosen file or directory. It will recursively go over all .module.scss files in the directory and create .d.ts type definitions for them.
If there already are type definitions it will only recreate them if the SCSS file was modified.
If you want to also recreate existing type definitions, run the command with the --all or -a flag.
You should configure your IDE to run the script on save for the best possible experience!
Benefits
Using type definitions for your .module.scss files will give you two main benefits:
- Your IDE can autocomplete your classNames.
- Your IDE will highlight every className that isn't defined in your .module.scss file as an error.
What if my colleagues don't like it?
If you don't want to force your colleagues to also use scss-typer, then you can just add the following rule to your .gitignore file:
*.module.scss.d.ts
This will ensure that none of the files generated by scss-typer will be tracked by git. Meaning that they will only remain on your computer.
Contributors
Niklas Ziermann
License
MIT License