Hello everyone π,
Intro
A year ago, I published an NPM package to generate a Sass file structure at the root of a project.
The goal behind this idea was to help our dev team to have "one source of truth" regarding the way we organized our code. And it worked well at first. We all used it, to start a new project, and it became more maintainable.
But there was one big issue that we could not solve with this package, it was not flexible enough.
Because not all projects are the same, having to use the same template for all our projects was not ideal.
The solution: create a CLI to give more options to the devs, like choosing the path of installation, multiple templates, "helper" code, etc.
The CLI
The CLI generates a Sass file structure based on the 7-1 pattern. You can choose where you want to install it into your project. It comes with (variables, mixins, functions, and maps to generate helper CSS classes).
If you only want to file structure, but without any code, you can select the "clean" template. It will generate all the files, without any starter code.
Otherwise, you also have the option to remove the specific folder from the structure. Don't need a vendor or theme folder, no problem, simply select which folder you want to discard from the original structure.
Structure
scss
β
βββ abstracts
βΒ Β βββ colors
βΒ Β βββ fonts
βΒ Β βββ index
β βββ mixins
βΒ Β βββ spacing
βΒ Β βββ helper
β
βββ base
βΒ Β βββ global.scss
βΒ Β βββ shame.scss
βΒ Β βββ typography.scss
β
βββ components
βΒ Β βββ alert.scss
β βββ banner.scss
βΒ Β βββ buttons.scss
βΒ Β βββ card.scss
βΒ Β βββ forms.scss
βΒ Β βββ icons.scss
βΒ Β βββ menu.scss
βΒ Β βββ modal.scss
βΒ Β βββ progress.scss
βΒ Β βββ table.scss
β
βββ layout
βΒ Β βββ footer.scss
βΒ Β βββ grid.scss
βΒ Β βββ header.scss
βΒ Β βββ navigation.scss
βΒ Β βββ sidebar.scss
β
βββ pages
βΒ Β βββ home.scss
β
βββ themes
βΒ Β βββ dark.scss
β
βββ vendor
βΒ Β βββ normalize.scss
β
βββ main.scss
Installation
Prerequisites
You can install the package globally or execute it right away with npx.
Global install
npm i -g create-scss-cli
After that, you'll be able to use the create-scss-cli command in your project like so:
cs-cli
NPX
npx create-scss-cli
Documentation
π https://www.createscss.com/
π https://github.com/maximedaraize/create-scss-cli
π https://www.npmjs.com/package/create-scss-cli
Conclusion
I would really appreciate any feedback. This is a side-project but I have the intention to keep working on it. Contribution is welcome π€
Thanks for reading,
Max
Top comments (0)