I am using Sass with Webpack which allows me to prefix imports with ~ which tells webpack to load the file from node_modules or other directories defined in webpack.config.js. I was wondering if there were any way to tell the sass syntax checker to look up in those directories as well so I can get rid of the "File to import not found or unreadable" errors I am getting.
Example:
@import "~theme/common";
Generates the following error:
ui/PageHeader/styles.scss|1 error| File to import not found or unreadable: ~theme/common.
Come on, you should know by now that syntastic doesn't know (nor care) about the contents of the files it checks. It's sass that does all the work, and it's up to you to call it with a combination of options that makes sense for your project. To _see_ how syntastic calls sass enable debugging and look at the logs. To _change_ the way syntastic calls sass set g:syntastic_sass_sass_args. To find out how to make sass not whine about ~ (if at all possible), consider asking on some SASS forum. To make syntastic ignore the errors, set syntastic_sass_sass_quiet_messages. Anything else is not really on topic here...
For future reference, the fix was to install sass-lint (npm install -g sass-lint), update Syntastic and add the following line to my .vimrc:
let g:syntastic_scss_checkers = [ 'sass_lint' ]
thanks @olalonde , to be more specific i fixed this by doing:
npm install -g sass-lint
then in your .vimrc
let g:syntastic_scss_checkers = [ 'sass_lint' ]
let g:syntastic_sass_sass_args = '-I ' . getcwd()
Most helpful comment
For future reference, the fix was to install sass-lint (
npm install -g sass-lint), update Syntastic and add the following line to my.vimrc: