Sass-Lint is a pure node.js-only tool to help you write clean and consistent SCSS and Sass. Newly generated Adaptive.js projects use this tool by default, leveraging a Grunt task wrapper to invoke it. You can also run it manually from the command line, which will output any problems with your SCSS, including the filename and line number(s).
When enabled in an Adaptive.js project, Sass files may be linted by invoking grunt sasslint or grunt scsslint.
- Node.js v4.X LTS and NPM v2.X (installed via NVM as directed in the Adaptive.js docs)
- Files must be written in SCSS syntax
Mobify's Sass-Lint rules in the Code Style GitHub Repo
Make sure you have all the requirements. Install Sass-Lint by running this command in your Terminal:
npm install -g sass-lint
Install the Mobify Code Style by running this command in your Terminal:
npm install -g mobify-code-style
Note that the above npm install commands shouldn't need sudo if you are using NVM (as recommended in the Adaptive.js docs)
Follow the steps below for your preferred text editor.
- Install the following packages:
- Configure your Atom settings for linter-sass-lint:
- .sass-lint.yml Config File path:
Run
npm config get prefixand append/lib/node_modules/mobify-code-style/css/.sass-lint.ymlto the result - Global Node Installation Path:
Run
npm get prefixand insert the result - Enable "Use global sass-lint installation"
- .sass-lint.yml Config File path:
Run
- Restart Atom
- Check a SCSS file to make sure that sass-lint is working
Before you start, make sure you have Package Control installed for Sublime Text.
- Using Package Control, install SublimeLinter
- Using Package Control, install SublimeLinter-sass-lint
- In the directory where you have all your Mobify and Adaptive projects, create a symlink named
.sass-lint.ymlthat is linked to your machine's global version of the "mobify-code-style" that you installed above:ln -s path/to/your/local/mobify-code-style/css/.sass-lint.yml ./.sass-lint.yml- Your local path can be found by running
npm config get prefixand appending/lib/node_modules/
- Restart Sublime Text
- Check a SCSS file to make sure that sass-lint is working