lydell / autoprefixer-brunch

[DEPRECATED] Adds autoprefixer support to brunch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LESS/Sass/Stylus Mixins/Vars Only

jupl opened this issue · comments

commented

I think this plugin should just concern itself with CSS only (not LESS, Sass, Stylus, etc.) by removing the pattern parameter since it would likely be one of the last steps. (at least before minification) EDIT: Likely not the solution.

One issue that happens is I may have a file called variables.xxx or mixins.xxx that only contains variables and mixins that are to be included in other files. Those files don't have any CSS and the plugin complains that result is undefined. I could avoid this by preceding with an underscore, but then it doesn't get monitored by watch.

pattern will go away when the fix for brunch/brunch#748 is released: d3f334a. I don’t know if it solves your problem, though. However, are you sure that you’ve read this in the readme?

Make sure that it is listed after any CSS preprocessors in the dependencies.

commented

Yeah. I put it as the last thing to verify and it still happens.

.../node_modules/autoprefixer-brunch/lib/index.js:34
      data: result.css,
                  ^
TypeError: Cannot read property 'css' of undefined
    at AutoprefixerCompiler.module.exports.AutoprefixerCompiler.compile (.../node_modules/autoprefixer-brunch/lib/index.js:34:19)

Here is what I'm testing right now in Sass:

app.scss

@import "app/base";

body {
  @include border-box;
}

base.scss

@mixin border-box {
  box-sizing: border-box;
}

Thanks for that test case! This feels like a bug somewhere. Hopefully I get time to investigate this next week. It would be really awesome if you could try if out with brunch master and the commit I mentioned above.

commented

Just gave it a shot with Brunch master. Same thing. :\

Also to verify tried this with a single file and everything works as expected.

@mixin border-box {
  box-sizing: border-box;
}

body {
  @include border-box;
}
commented

Another issue is when I have a blank _base.scss file and the following:

app.scss

@import "app/base";

Without autoprefixer-brunch the generated app.css is blank as expected. However, with autoprefixer-brunch included strangely the following is generated:

app.css

@import "app/base";

Granted, this isn't a normal use case but it is unexpected behavior.

Same thing on brunch master ... but you didn't say anything about the commit.

commented

Ah, you mean use both Brunch master and your specific autoprefixer-brunch commit?

Yes ;)

commented

Yes that did the trick. Cool, I'll wait patiently then for now.

You can probably use this in your package.json:

"brunch": "brunch/brunch",
"autoprefixer-brunch": "lydell/autoprefixer-brunch#optimizer"

until it is released.