-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(sass resolve paths) #2747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sass resolve paths) #2747
Conversation
8afe09d
to
5bf747d
Compare
What's your use case for this? |
@grizzm0
// angular-cli.json
{
"apps": [
{
"styles": [
"styles/main.sass"
],
"sassPaths": [
"styles"
],
}
]
} // app.component.sass
@import 'variables'
:host
color: $text-color |
5bf747d
to
3aa4800
Compare
Both less and stylus has support for paths aswell. If you're going to implement it you should create an implementation that works across all three. |
As @grizzm0 indicated there are similar options for less and stylus, generalizing the setting would probably be a good idea. Having a sass specific sub-option at the app level seems like a bad precedent to set. Another option is to allow node-sass settings (as well as less and stylus) to be set via a more comprehensive addition to the config file. However, this may extended into the future add-on support. (which this PR may as well). @filipesilva, out of curiosity, is there a plan or initial design concept for the add-ons feature? |
As far as I can see, less-loader use webpack's Probably, |
Acualy, I like @import '~@styles/variables' But, we, probably, should care about conflicts with |
@ValeryVS, I experimented with alias as well. It's somewhat awkward as it can conflict with ts (as you said) and the stylesheets are now specific to webpack and its configuration. The less and stylus loaders both seem to support a Overall, stylesheet configuration is extremely basic right now. A more detailed plan to allow configuration of the available pre-processors as well as postcss would probably be a good long-term goal. Not that this PR is the place for that. But include paths is a good first step, as this is the missing analog to tsconfig's path support. |
…r's includePaths support
3aa4800
to
554efb4
Compare
So this functionality... using We're wary of adding new properties to Tests would also be required to make sure that it works, https://github.com/angular/angular-cli/tree/master/tests/e2e/tests/build/styles is the best spot to add them. @clydin nothing to share yet, I'm sorry. It's post 1.0 still. |
@filipesilva Thanks for reply and instructions. I will check less and stylus loaders for paths support, add tests and update request. |
This is blocked until webpack-contrib/less-loader#75 is merged. @filipesilva sass-loader and stylus-loader support |
What if we create another pull-request that is not precompiler but that is not waiting for less-loader to merge a 8months old ? This is actually very blocking: s(a|s)css import paths are just mandatory to use |
I think we should make sass (and stylus) paths support. And then wait for less-loader update. |
@filipesilva What do you think? This feature is the only reason why my company has to use its own workflow instead of the angular-cli. So it would be great to get this in! |
I think it would be good for such support to go in, but am concerned about the robustness of such a system. Besides being well tested, we'd have to adequately (and dynamically) configure each loader that makes use use of include paths. So that's the reason why this feature needs to be well planned. I'm going to bring it up for direct discussion though in hope we can prioritise it. |
I've provided a use case in: #3683 I need to use a sass library that in itself relies on another third party library (in this case Also to illustrate the usage with the top level import with component sass: |
Hugely valuable feature. Another use case is utilising styles from material-components or other libs using npm scoped modules |
I think this is critical for people using bootstrap as well as a base in our component libraries in enterprises. Referencing node_modules directly "works" in the component lib but breaks when we pull the lib in and the cli tries to resolve the scss files for the component library. |
I've encountered this as well, using Is there any general consensus on this PR? |
I have an up to date implementation in #3724 that supports sass and stylus. I think the issue we're up against is that there's a one year old PR for the webpack less loader preventing support for LESS: webpack-contrib/less-loader/pull/75 I'd agree on supporting less later though... |
Superseded by #4003 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Change webpack config to implement sassLoader's includePaths support.
Fix #1791