tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 53 forks source link

Using with Jade #44

Closed Grawl closed 10 years ago

Grawl commented 10 years ago

I am using newer with contrib-jade and modified imports does not triggers parent template compile.

template.jade

p some content
block superblock
    p some block content

modules/sub.jade

append superblock
    p add this to my block

And when I change sub.jade I want to compile template.jade but watcher do not do it. Same problem with include. Maybe a problem is in my gruntfile config?

I tried to use override function but get Fatal error: checkForModifiedImports is not defined on this. Is checkForModifiedImports are example function name that I need to write on my own?

My gruntfile: https://gist.github.com/Grawl/0eef67b20a40ec97ace

ruanmer commented 10 years ago

+1 same problem here

Grawl commented 10 years ago

I just find a working solution into someone's gruntfile.coffee#105 on Github. it's simple as 1,2,3: if detail.task is 'jade then include true. and it works. so just add this code below to your gruntfile before watch

        newer:
            options:
                override: (detail, include) ->
                    if detail.task is 'jade'
                        include true
                    else
                        include false

you're awesome developer now!

xiaogwu commented 9 years ago

@Grawl include true seems to have the same result of compiling everything for me. For me I was looking for a sass solution so I did:

.... if (detail.task === 'sass') include(true); else include(false);

and this resulted in compiling all my scss files instead of just my imports. I think you have to define your own function.

brunowego commented 8 years ago

It works for me:

module.exports = {
  jade: {
    files: ['app/views/pages/{,*/}*.jade'],
    tasks: ['newer:jade:server'],
    options: {
      event: 'changed'
    }
  }
};
askucher commented 8 years ago

+1