Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

Getting optimisation issue with some CSS #36

Closed

Description

@MoOx

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)?

Activity

  1. jhnns commented on Jan 23, 2015

    @jhnns
    Contributor

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

  2. MoOx commented on Jan 23, 2015

    @MoOx
    Author

    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.

  3. sokra commented on Jan 23, 2015

    @sokra
    Member

    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.

  4. MoOx commented on Jan 23, 2015

    @MoOx
    Author

    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.

  5. sokra commented on Jan 26, 2015

    @sokra
    Member

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

  6. jhnns commented on Feb 3, 2015

    @jhnns
    Contributor

    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.

  7. MoOx commented on Feb 3, 2015

    @MoOx
    Author

    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...

  8. MoOx commented on Feb 3, 2015

    @MoOx
    Author

    Oh just saw you fix. Ouch.

  9. MoOx commented on Jun 18, 2015

    @MoOx
    Author

    Closing since you now use postcss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions