clean-css / clean-css-cli

The command line interface to clean-css CSS optimizer
MIT License
305 stars 17 forks source link

Breaking on remote @imports #11

Closed abhirakshit closed 2 years ago

abhirakshit commented 7 years ago

Hello,

I am trying to use cleancss as follows cleancss --inline all -o css/import.min.css css/import.css

But I get the following error

/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/writer/helpers.js:188
    switch (token[0]) {
                 ^
TypeError: Cannot read property '0' of undefined
    at all (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/writer/helpers.js:188:18)
    at serializeStyles (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/writer/simple.js:45:3)
    at /usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/clean.js:105:29
    at /usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/read-sources.js:26:64
    at loadOriginalSources (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/load-original-sources.js:26:5)
    at /usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/read-sources.js:26:14
    at applySourceMaps (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/apply-source-maps.js:34:5)
    at Object.callback (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/read-sources.js:25:12)
    at doInlineImports (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/read-sources.js:200:25)
    at inlineLocalStylesheet (/usr/local/lib/node_modules/clean-css-cli/node_modules/clean-css/lib/reader/read-sources.js:327:10)

I have the following remote imports

@import url("http://fonts.googleapis.com/css?family=Muli");
@import url("http://fonts.googleapis.com/css?family=Montserrat");
@import url("https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css");

I have tried to increase the timeout but get the same error. When I do "--inline local" it works fine though the remote imports are not fetched as expected.

Thanks

jakubpawlowicz commented 6 years ago

Sorry @abhirakshit for a really late reply, but this issue went under my radar. I've just retested it with the latest clean-css-cli and it works as expected. Could you provide me with more details (sample file) if still relevant or close this issue otherwise?

jakubpawlowicz commented 2 years ago

Closing as 'won't fix' as clean-css-cli is going into maintenance mode.