TrySound / postcss-easy-import

PostCSS plugin to inline @import rules content with extra features
MIT License
200 stars 25 forks source link

Resolve glob imports #33

Open Yankovsky opened 5 years ago

Yankovsky commented 5 years ago

I have following files: src/my.css

@import "vars.css";
* {
    color: $my-color;
}

src/vars.css

$my-color: red;

and index.css

@import './src/*.css';

When I run postcss index.css I get following result:

* {
    color: $my-color;
}

$my-color: red;

If I change the name of vars.css file to something like avars.css (which comes before my.css alphabetically) or if I use specific path in index.css instead of glob everything works as expected and the result is:

$my-color: red;

* {
    color: $my-color;
}

I think it is a bug and dependencies resolution shouldn't be broken by using globs.

Yankovsky commented 5 years ago

I thought that glob pattern resolution works by first obtaining all files matching pattern and then processing them through usual resolution algorithm.

Yankovsky commented 5 years ago

Funny thing is postcss-import pre glob removal didn't have that problem.

https://github.com/postcss/postcss-import/tree/7.1.3

Yankovsky commented 5 years ago

Could you describe imports resolution algo?