stylus/stylus-lang.com

undocumented @import / @require behavior for index styling

Opened this issue · 0 comments

Stylus currently resolves stylus files if they have the same name as their parent folder (with .styl extension).
For example:
given the following directory structure where test.styl is the input file and test.css is the output file

.
├── a
|   ├── a.styl
├── test.styl
├── test.css

and the following file contents

./test.styl

@require a

./a/a.styl

body
  background-color red

yields the following output
./test.css

body {
  background-color: #f00;
}

this seems like logical and intended behavior, but it appears to not be listed in the documentation ( or at least not in the @import.md index styles section:

@ import also supports index styles. This means when you @import blueprint, it will resolve
either blueprint.styl or blueprint/index.styl. This is really useful for libraries that want to expose all their features, while still allowing feature subsets to be imported.

Unless this behavior is unintended, it should probably be changed to something like:

@ import also supports index styles. This means when you @import blueprint, it will resolve
blueprint.styl, blueprint/index.styl, or blueprint/blueprint.styl . This is really useful for libraries that want to expose all their features, while still allowing feature subsets to be imported.