My Angular app is configured to use Stylus for its styling. Almost all my components' styles inherit from src/app/styles/common.styl
which provides configuration and mixins. However that means my stylus files all have long relative trails:
@import '../../../../styles/common';
This also means that when we set up a new component, we have to add this line then figure out the appropriate number of ../
's to add based on its folder nestling level.
I'd like to be able to use absolute paths instead, something like this that can be used from any component in the application regardless of folder nesting level:
@import '/styles/common';
What's the best practice for achieving this in Angular 7?
It looks like this is theoretical possible by configuring stylus-loader, but I can't find a clean way to do that for Angular. Custom webpack configs seem like a relevant option, but they appear to be used for wholesale replacing the default config rather than just amending it with a piece of configuration, and I would prefer not to have to redo the webpack configuration from the ground up to just configure a Stylus setting.
from How can we configure Stylus for absolute paths in Angular 7?
0 komentar:
Posting Komentar