brunch / stylus-brunch

Adds Stylus support to Brunch
MIT License
21 stars 2 forks source link

Support index styles #35

Closed m4dz closed 8 years ago

m4dz commented 8 years ago

Hi!

I'm working on a huge project with Stylus, and intensively use the index styles import feature. Basically, you can have a file tree like:

- styles
  |- main.styl
  `- foo
    |- index.styl
    |- _bar.styl
    `- _baz.styl

with foo/index.styl containing:

@import '_bar'
@import '_baz'

You then simply import the foo module in main style with:

@import 'foo'

to get the foo/index.styl file imported.

It works well at first compile time, but then, when brunch runs in watch mode, changes in any of the foo/* files is detected, but Brunch doesn't know where those files are imported as dependency, so the final CSS file isn't recompiled.

If you change the main import statement to @import 'foo/index', then it works well.

Can we add support for the implicit index import in the Brunch dependencies tree to get it working even in watch mode?

Thanks a lot!

es128 commented 8 years ago

I just opened an issue in progeny for adding this feature to the dependency resolution.

PR welcome. It was done in a fork (and never PR'd) a long time ago that you could use for reference, but the implementation would have to be modified to not rely on synchronous file system calls.

m4dz commented 8 years ago

Just saw in brunch-stylus code where dependencies are loaded. I'm looking to do a PR to handle it in progeny, thanks @es128!