Skip to content

Passing additional options to node-sass #1791

Description

@petomalina

Versions:
angular-cli: 1.0.0-beta.11-webpack.2
node: 6.2.2
os: linux x64

Is there a way to pass additional options to node-sass with current configuration files? This was previously possible with angular-cli-build.js.

I need to pass include directory of bootstrap-sass for the bootstrap-material-design library, as it is importing "bootstrap/*" files but the library is located inside node_modules.

Activity

  1. petomalina commented on Aug 23, 2016

    @petomalina
    Author

    I needed to customize webpack-build-development.ts file inside angular-cli so the library could be compiled correctly. Is there any way to do this by configuration in angular cli?

    https://www.diffchecker.com/05czn5se

  2. added
    P5The team acknowledges the request but does not plan to address it, it remains open for discussion
    on Aug 23, 2016
  3. filipesilva commented on Aug 23, 2016

    @filipesilva
    Contributor

    There is no way to do this right now, but we're getting a few requests for ways to add paths so it's likely to make it in.

  4. josenriq commented on Sep 27, 2016

    @josenriq

    @gelidus Great hack. I wanted to do the same, but it doesn't seem to work.

    • Changed webpack-build-development.ts
    • Rebuilt the angular-cli project and ran npm link.
    • Installed npm install bootstrap-sass as well, as that seems to be the path you referred to here https://www.diffchecker.com/05czn5se

    Still getting the same errors for "bootstrap/*". Any suggestions are greatly appreciated.

  5. vmasek commented on Sep 29, 2016

    @vmasek

    @linktothapast
    I've written a workaround that works with angular-cli 1.0.0-beta.15, for 1.0.0-beta.11-webpack.2 just locate right files and adjust the script.

    http://stackoverflow.com/questions/39635971/angular-cli-configure-sass-loader-to-include-node-modules-in-includepath/39726440#39726440

  6. self-assigned this
    on Dec 9, 2016
  7. hansl commented on Dec 21, 2016

    @hansl
    Contributor

    Closing this as obsolete. We support this.

  8. filipesilva commented on Dec 30, 2016

    @filipesilva
    Contributor

    @hansl we don't yet support it, work is ongoing in #2747. Its on my shortlist of stuff to look at and get sorted.

  9. armstrjare commented on Jan 11, 2017

    @armstrjare

    FYI for those looking for a temporary workaround on this, I've found one that works with SASS. The SASS compiler uses a SASS_PATH env variable, so if you set that then everything seems to work swell. You just need to make sure the env var is set when you run any ng commands.

    In my project root directory, I have:

    # env.rc
    export SASS_PATH="`pwd`/src/css"
    

    And in my package.json:

    {
      "scripts": {
         "start": "source ./env.rc && ng serve"
         ...
       }
    }
    
  10. added 2 commits that reference this issue on Jan 13, 2017
    e8a741d
    4476f61
  11. 2 remaining items

  12. added 4 commits that reference this issue on Jan 13, 2017
    bdd4b36
    28c1a23
    c181c0c
    f1cd870
  13. added a commit that references this issue on Jan 19, 2017
    e5ef996
  14. added a commit that references this issue on Feb 9, 2017
    3ec5396
  15. jpzwarte commented on Feb 24, 2017

    @jpzwarte

    Why limit this to just includePaths? I want to use the node-sass data option (https://github.com/sass/node-sass#data) to automatically include a setup stylesheet for all components:

    data: '@import \'variables\';'
    

    This way, you don't have to include the variables stylesheet in every component stylesheet where you want to use global variables.

    Please change additionalProperties to true?. cc @filipesilva

  16. Ennas commented on Jun 26, 2017

    @Ennas

    Is this fix (i.e using stylePreprocessorOptions) available for LESS?

  17. filipesilva commented on Jun 28, 2017

    @filipesilva
    Contributor

    @jpzwarte we're not looking at adding all the configuration options each preprocessor supports, it would be practically unmaintainable. This one was a highly demanded one so it was added.

    @Ennas no, LESS did not support it at the time AFAIK.

  18. jpzwarte commented on Jun 28, 2017

    @jpzwarte

    @filipesilva i understand :) It's just that having a "setup" stylesheet with SASS variables & mixins and not having to @import that everywhere seems like something that adds value for everyone :)

  19. spikyjt commented on May 10, 2018

    @spikyjt

    @filipesilva I'm not quite sure why we can't just pass through any options that preprocessors support, rather than having to "support" them? I can see from the way that you have implemented this option, that it would be unmaintainable to have to set them all up in webpack-build-styles.ts. However, there is also much demand for the data option, see #1253 #3700 and comments on https://netbasal.com/angular-cli-and-global-sass-variables-a1b92d8ca9b7 to mention a few.

    Since the data property would just be passed through as is, would adding it be a big job?

  20. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    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.

  21. locked and limited conversation to collaborators on Sep 8, 2019
  22. added a commit that references this issue on May 29, 2026
    319d066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P5The team acknowledges the request but does not plan to address it, it remains open for discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions