Grunt: When the depended @import target is modified, how to compile the parent depender?

281 views Asked by At

I'm trying to migrate my Stylus compilation process from CodeKit to Grunt.

Here's how the files are structured:

/styl
  - page-1.styl
  - page-2.styl
  - …
  - /components
    - header.styl
    - footer.styl
    - module-1.styl
    - …

Each page-x.styl in the dir root has @import statements that pull module stylesheets from the ./styl/components subdir.

For example, page-1.styl looks like this:

 @import 'components/header'
 @import 'components/module-1'

 // Other styles here
 .foo { … }
 …

When I modify components/header.styl, CodeKit smartly picks up the @import relationship and compiles page-1.styl (and other files that import the same modified file) accordingly, and even gets bonus points for excluding components/header.styl itself from compilation too.

Unsurprisingly, this doesn't happen using grunt-contrib-watch + grunt-contrib-stylus alone. Has anyone managed to get this working through Grunt?

0

There are 0 answers