Angular -CLI Sass

I am using the latest version of Angular -CLI to create an Angular2 project. I have a sass file with variables in src / assets / styles / _vars.scss. Is it possible to configure a sass compiler, so I need to write

@import "vars"; 

Instead of writing the full path or relative path?

+8
angular sass angular-cli
source share
1 answer

Lucky you. See this pr .

As an example, when using sass, you would like to add a stylePreprocessorOptions object to your application configuration in angular-cli.json . For example:

 "apps": [ { "stylePreprocessorOptions": { "includePaths": [ "styles" // This would point to the `my-app/src/styles` directory ] } } ] 

From here, if you have a scss file like my-app/src/styles/_vars.scss , you can

 @import 'vars' 

through your applications scss files.

Remember to update angular-cli to at least 1.0.0-beta.26 .

+15
source share

All Articles