You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
~ tilde operator not working as expected (and as it did before)聽#14387
I think I might have solved the issue and now both the IDE and the cli work as expected.
I can use this import: @import "~scss/some-style"; and it will refer to src/scss/some-style.scss.
Just not sure if everything's correct:
That being said, I would strongly advice against using ~ especially for local imports, as this is quite a Webpack specific feature and it's not guaranteed that this behaviour will continue to work in the future, there are 2 options which are natively available in sass compiler that one should prefer.
Relative paths
Include paths
@clydin, can you chime in and confirm if we should address the above?
Hi @alan-agius4 thanks for your reply.
I guess the best option is the stylePreprocessorOptions (as you say, include paths).
I'm too lazy!!! :)
Luckily I only have one folder I use this way!
Should I close this issue?
Activity
[-]~ tilde operator doesn't work as expected[/-][+]~ tilde operator not working as expected (and as it did before)[/+]tonysamperi commentedon May 9, 2019
I just noticed that in my
angular.jsonI haveIf I change
rootvalue tosrcI can use in my
scssfiles~scss/some-styleas I did before...But still not working when launching
ng servetonysamperi commentedon May 9, 2019
I think I might have solved the issue and now both the IDE and the cli work as expected.
I can use this import:
@import "~scss/some-style";and it will refer tosrc/scss/some-style.scss.Just not sure if everything's correct:
angular.json:tsconfig.jsonandsrc/tsconfig.app.jsonalan-agius4 commentedon May 13, 2019
Hi @tonysamperi, thanks for reaching out.
The problem with the above is that
sourceRootis not part of the listed modules entrieshttps://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L331
That being said, I would strongly advice against using
~especially for local imports, as this is quite a Webpack specific feature and it's not guaranteed that this behaviour will continue to work in the future, there are 2 options which are natively available in sass compiler that one should prefer.@clydin, can you chime in and confirm if we should address the above?
tonysamperi commentedon May 13, 2019
Hi @alan-agius4 thanks for your reply.
I guess the best option is the
stylePreprocessorOptions(as you say, include paths).I'm too lazy!!! :)
Luckily I only have one folder I use this way!
Should I close this issue?
angular-automatic-lock-bot commentedon Sep 9, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.