Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting optimisation issue with some CSS #36

Closed
MoOx opened this issue Jan 23, 2015 · 9 comments
Closed

Getting optimisation issue with some CSS #36

MoOx opened this issue Jan 23, 2015 · 9 comments

Comments

@MoOx
Copy link

MoOx commented Jan 23, 2015

When I use webpack -p, I'm getting a non helping error message

ERROR in ./~/css-loader!./~/cssnext-loader!./src/index.css
Module build failed: Error: Please check the validity of the CSS block starting from the line #1
    at throwError (/.../node_modules/css-loader/node_modules/csso/lib/gonzales.cssp.node.js:399:15)
    at checkStylesheet (/.../node_modules/css-loader/node_modules/csso/lib/gonzales.cssp.node.js:1921:22)
    at Object.CSSPRules.stylesheet (/.../node_modules/css-loader/node_modules/csso/lib/gonzales.cssp.node.js:365:40)
    at _getAST (/.../node_modules/css-loader/node_modules/csso/lib/gonzales.cssp.node.js:409:38)
    at exports.srcToCSSP (/.../node_modules/css-loader/node_modules/csso/lib/gonzales.cssp.node.js:2287:16)
    at Object.exports.srcToCSSP (/.../node_modules/css-loader/node_modules/csso/lib/gonzales.cssp.node.js:2292:16)
    at Object.exports.parse (/.../node_modules/css-loader/node_modules/csso/lib/cssoapi.js:7:21)
    at Object.module.exports (/.../node_modules/css-loader/index.js:18:18)
 @ ./src/index.css 4:14-293

In this index.css I just have some inlined @import, so this error is not really helping.
Is there any way to improve that?

My first import is normalize.css and after taking a look in the <style> element I saw some empty :root elements (due to the fact I use future proof CSS transformed via cssnext).
It seems the parser you are using is kind of outdated for some part.

If you are using csso for minification, would you consider switch to a more fresh tool (csswring) based on an parser with an active development (postcss)?

@jhnns
Copy link
Member

jhnns commented Jan 23, 2015

PostCSS is backed by Autoprefixer, so it's probably developed more actively. 👍

@MoOx
Copy link
Author

MoOx commented Jan 23, 2015

postcss 4 is really fast (just run this to check it out https://github.com/postcss/postcss/tree/master/benchmark ) & even support CSS specs that are not implemented in browsers. So seems a really good choice indeed.

@sokra
Copy link
Member

sokra commented Jan 23, 2015

Yes, write a PR... I've already tried to use an alternative library in the rework branch.
Check that all test pass and maybe add some for the new stuff.

The rework branch doesn't work out, because it removed the whitespace from css and this would break SourceMap.

@MoOx
Copy link
Author

MoOx commented Jan 23, 2015

rework is kind of unmaintained (last commit is from august 2014).
More & more people are switching to postcss now that the ecosystem start to be consistent.

@sokra
Copy link
Member

sokra commented Jan 26, 2015

yeah... I'm fine if you do a PR with postcss.

@jhnns
Copy link
Member

jhnns commented Feb 3, 2015

Since a rewrite with PostCSS is probably rather expensive, we should add a quickfix for the status quo because the current problem renders the css-loader useless.

@MoOx
Copy link
Author

MoOx commented Feb 3, 2015

A rewrite with postcss should be pretty quick since postcss-import can do the inline & postcss-url can do accept a callback to handle what to do with the url.
A "quickfix" should be to fix the parser, which seems heavier to me than using postcss-import + url plugins...

@MoOx
Copy link
Author

MoOx commented Feb 3, 2015

Oh just saw you fix. Ouch.

@MoOx
Copy link
Author

MoOx commented Jun 18, 2015

Closing since you now use postcss

@MoOx MoOx closed this as completed Jun 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants