angular-cli/docs/documentation/stories/css-preprocessors.md
Alan 068bb4001d docs: add deprecation and pr note
Docs are deprecated in favor of the the new pages in AIO which are WIP.
2019-01-09 09:14:13 -08:00

1.2 KiB

Documentation below is deprecated and we no longer accept PRs to improve this. The new documentation will be available here angular.io.

CSS Preprocessor integration

Angular CLI supports all major CSS preprocessors:

To use these preprocessors simply add the file to your component's styleUrls:

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'app works!';
}

When generating a new project you can also define which extension you want for style files:

ng new sassy-project --style=sass

Or set the default style on an existing project:

ng config schematics.@schematics/angular:component.styleext scss
# note: @schematics/angular is the default schematic for the Angular CLI

Style strings added to the @Component.styles array must be written in CSS because the CLI cannot apply a pre-processor to inline styles.