3

I am trying to use grunt-newer to pick up changes to my sass partials to then run the grunt-sass task. For some reason, it doesn't seem to register any updates. Argh!

Example directory structure:

sass
    - components
        _breadcrumb.scss
    - helpers
        _variables.scss
    main.scss

Sass config:

files: [{
    expand: true,
    cwd: 'static/sass',
    src: ['*.scss'],
    // src: ['**/*.scss'],
    dest: 'static/styles',
    ext: '.css'
}]

main.scss contains the @imports used to read in the partials.

Running grunt newer:sass will look for changes to main.scss. Updating the globbing rule to use **/*.scss doesn't pick up any changes at all in any file.

It feels like a globbing issue but I just can't crack it.

Any help would be appreciated.

digitalclubb
  • 585
  • 1
  • 5
  • 14
  • How do you run the task? – Alexander Aug 06 '15 at 12:31
  • I want to run it as part of a concurrent task, part of deployment. For this test though I am simply running it standalone. Updating a scss partial, running newer and going from there – digitalclubb Aug 06 '15 at 12:44
  • I believe this may be related to using the expand syntax. See https://github.com/tschaub/grunt-newer/issues/39#issuecomment-91271470 – digitalclubb Aug 06 '15 at 15:56

1 Answers1

0

See grunt-newer page, specifically the section 'overwrite' at the end of the page. That's the way to go.

grunt.config('newer', {
  options: {
    override: function (detail, include) {
      if (detail.task == 'sass') {
        if (detail.path.match('^sass/includes/')) {
          include(true);
        }
        else {
          include(false);
        }
      }
      else {
        include(false);
      }
    }
  }
});

(don't forget to adapt and expand ^sass/includes/ to your filetree)

I am not yet 100% sure if this scans ALL files in that folder EVERY time no matter if they are "newer" or not, though...

Hafenkranich
  • 1,696
  • 18
  • 32