How do you set up Stylus in Angular2 CLI project?
Asked Answered
M

2

7

I'd like to use Stylus instead of standard CSS in my Angular2 CLI project. I've had a look around and can't find any solid sources on how to set this up.

Matri answered 10/5, 2017 at 7:50 Comment(1)
Different pre-processors are set via --style on ng new (plain css default). So ng new --style styl <ProjectName>. Pre-processing by included plugins, with no batteries included.Capias
S
5

When you start the project with Angular-cli run:

ng new my-app --style styl

Angular 6+ To change pre-processor on existing project run:

ng config schematics.@schematics/angular:component.styleext styl

BELOW Angular 6 To change pre-processor on existing project run:

ng set defaults.styleExt styl
Skvorak answered 20/9, 2018 at 14:15 Comment(0)
L
0

Although correct the previous answer is out of date. If you try to run it you will get...

Error: Invalid values:
  Argument: style, Given: "styl", Choices: "css", "scss", "sass", "less"

Now you need to use one of the others like ng new my-app --style sass

Lemon answered 19/11, 2023 at 17:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.