Reputation: 1103
I'm doing some UI dev in an Angular 2 (v4) project and currently have to re-run ng serve...
to recompile the new styles, in order to get them to display in the app.
Is there a way to get the CSS styles to auto-compile in the same way adding html tags to a given component updates the app realtime?
Upvotes: 2
Views: 85
Reputation: 24434
There is two ways to add css file to your project:
one way add the css file to assets folderthen import the file from style.css like this
@import url('./assets/theme.css');
in this case the file will be watch to change
another way from angular.json add the css file to styles array
"styles": [
"src/assets/theme.css",
"src/styles.css"
],
notes that any change on angular.json file required to run angular server againg
{{ 'Happy Coding' }}
Upvotes: 1
Reputation: 476
It should automatically do that while serving. Please provide more details.
Try disabling Use "safe write" in Settings of your IDE if that's a thing. It might cause that problem incidentally ( Settings | Appearance & Behavior | System Settings in Jetbrains problems)
Change Angular CLI version?
Check out your .angular-cli.json could be something in there.
Upvotes: 1