Reputation: 7250
I have two question regarding scss
file imports in Angular6
component.scss
files after having imported it once in global src/sass/styles.scss
. Shouldn't importing it once be enough?SCSS
partials using import shortcut ~ ? All my partials are contained in src/sass
folder. This is fine: @import '../sass/variables';//in app.component.scss
But this throws error: @import '~sass/variables'
:
ERROR in ./src/app/app.component.scss Module build failed: @import '~sass/variables'; ^ File to import not found or unreadable: ~sass/variables. in C:\Users\sandeepkumar.g\Desktop\nodebook\tdlr-this\src\app\app.component.scss (line 2, column 1)
`
angular.json:
"styles": [
...
"src/sass/styles.scss"
],
My folder structure:
Upvotes: 9
Views: 12611
Reputation: 7250
Answering my own question. It turns out both of these problems are "bug" in Angular 6.
Angular6
. Issue. Use ~src
instead to import scss.Upvotes: 15