Skip to content

SCSS compiling is not ignoring my partials #551

Closed
castell482/angular-cli
#13

Description

@sharpmachine

When using node-sass via the Angular 2 CLI, if I have a file called _variables.scss, my expectation is that it will not compile to CSS, but it does. How can I set that to not do that?

OSX El Capitian

angular-cli: 0.0.34
node: 4.2.6
os: darwin x64

Activity

  1. jkuri commented on Apr 28, 2016

    @jkuri
    Contributor

    For something that would be long-term solution; you can't. You can customize lib/broccoli/angular-brocolli-sass.js regex to exclude files that are prefixed with _, but will work only until you'll update angular-cli :-). We cannot know which files are you want to get compiled and which not so it compiles all files that have .scss extension.

  2. cladera commented on Apr 29, 2016

    @cladera
    Contributor

    Ignoring files prefixed with '_' is kind of a convention in sass so It would make a lot of sense to create an option we can pass to Angular2App constructor.

  3. sharpmachine commented on Apr 29, 2016

    @sharpmachine
    Author

    Thanks @cladera. My understanding was also that files prefixed with '_' were ignored and not complied. Thanks for confirming that.

  4. BrunoAMSilva commented on May 6, 2016

    @BrunoAMSilva

    @cladera I agree, adding this configuration is the best option, doesn't hurt anyone and would avoid the pain of changing angular-bricolli-sass.js for every member of my team. 👍

    @jkuri Is there any chance this feature could be added?

  5. griezma commented on May 16, 2016

    @griezma

    yes convention over configuration. sass specs are clear about it.

  6. apavillet commented on May 25, 2016

    @apavillet

    for anyone struggling with this use this in angular-cli-build.js add this

    "sassCompiler": {
    "cacheExclude": [//_[^\/]+$/]
    }

  7. sharpmachine commented on May 25, 2016

    @sharpmachine
    Author

    @apavillet Where exactly? I just tried adding it inside the Angular2App(defaults) but it got massive errors.

  8. apavillet commented on May 25, 2016

    @apavillet

    Here is the angular-cli-build i have

    /* global require, module */

    var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

    module.exports = function(defaults) {
    return new Angular2App(defaults, {
    vendorNpmFiles: [
    'systemjs/dist/system-polyfills.js',
    'systemjs/dist/system.src.js',
    'zone.js/dist//*.+(js|js.map)',
    'es6-shim/es6-shim.js',
    'reflect-metadata/
    /.+(js|js.map)',
    'rxjs/__/
    .+(js|js.map)',
    '@angular//*.+(js|js.map)',
    'moment/
    /.+(js|js.map)',
    'ng2-translate/__/
    .+(js|js.map)',
    'ng2-bootstrap/*/.+(js|js.map)',
    'angular2-moment/.+(js|js.map)',
    'boosted/
    /.+(js|css)',
    'bootstrap//.+(js|css)',
    'animate.css/
    /.+(js|css)'
    ],
    "sassCompiler": {
    "cacheExclude": [//_[^\/]+$/]
    }
    });
    };

    SCSS is compiled fine, @sharpmachine

  9. sharpmachine commented on May 25, 2016

    @sharpmachine
    Author

    @apavillet Now I don't get the errors but it still complied my new file prefixed with '_' to css.

  10. apavillet commented on May 26, 2016

    @apavillet

    I'm not an expert on this kind of things but you should make sure you have the latest version, since the PR allowing this is quite recent

  11. sharpmachine commented on May 26, 2016

    @sharpmachine
    Author

    Thanks @apavillet. I updated and now it's working.

  12. sharpmachine commented on Jun 3, 2016

    @sharpmachine
    Author

    So the only problem now is saving a partial SCSS file doesn't trigger a recompile of the main SCSS file so I have to save both the partial and the main to see my changes.

  13. andyford commented on Jul 7, 2016

    @andyford

    There was a fix af9a4f9

    I was having this problem with angular-cli 1.0.0-beta.8, but it's working fine after upgrading to 1.0.0-beta.9
    (thanks to my colleague @kevinmerckx for pointing this out!)

  14. angular-automatic-lock-bot commented on Sep 5, 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.

  15. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions