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

Error when using inline:['all'] for imports #45

Closed
lubomirblazekcz opened this issue Aug 17, 2017 · 4 comments
Closed

Error when using inline:['all'] for imports #45

lubomirblazekcz opened this issue Aug 17, 2017 · 4 comments

Comments

@lubomirblazekcz
Copy link

I got token[0] error, when using inline:['all'] option, I'm trying to inline process @import url(https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css);

Is this problem with clean-css or gulp-clean-css? I have gulp-clean-css@3.7.0, clean-css@4.1.7 versions and node.js 6.11.2

I was used to that clean css processed imports automatically, but since the clean-css version 4.0 it was changed and I can't get it working

        .pipe(minifycss({
            compatibility: 'ie9',
            inline: ['all']
        }))

Error:

C:\Projects\newlogic-ui\node_modules\clean-css\lib\optimizer\level-1\optimize.js:628
    switch (token[0]) {
                 ^

TypeError: Cannot read property '0' of undefined
    at level1Optimize (C:\Projects\newlogic-ui\node_modules\clean-css\lib\optimizer\level-1\optimize.js:628:18)
    at optimize (C:\Projects\newlogic-ui\node_modules\clean-css\lib\clean.js:128:5)
    at C:\Projects\newlogic-ui\node_modules\clean-css\lib\clean.js:104:29
    at C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\read-sources.js:26:64
    at loadOriginalSources (C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\load-original-sources.js:26:5)
    at C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\read-sources.js:26:14
    at applySourceMaps (C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\apply-source-maps.js:34:5)
    at Object.callback (C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\read-sources.js:25:12)
    at doInlineImports (C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\read-sources.js:200:25)
    at inlineLocalStylesheet (C:\Projects\newlogic-ui\node_modules\clean-css\lib\reader\read-sources.js:327:10)
@scniro
Copy link
Owner

scniro commented Aug 18, 2017

At first glance this appears to be an issue with clean-css itself as I can see it bubbling up from the lib in the stack trace and not from the wrapper. Have you checked out the Important: 4.0 breaking changes migration docs? I haven't used remote imports a lot but it makes mention of the following...

Remote @import rules are NOT inlined by default anymore

To be honest, I'm not sure what implications this may have - but perhaps this is a starting point?

@lubomirblazekcz
Copy link
Author

lubomirblazekcz commented Aug 18, 2017

yeah, it's problem with clean-css, it's happening when multiple files are processed - https://github.com/jakubpawlowicz/clean-css#how-to-optimize-multiple-files

if the @import is passed as string it works, I have opened issue on clean-css -clean-css/clean-css#966

@lubomirblazekcz
Copy link
Author

@scniro This was fixed in https://github.com/jakubpawlowicz/clean-css/releases/tag/v4.1.8 can you update the dependency to 4.1.8? Thanks!

@scniro
Copy link
Owner

scniro commented Sep 4, 2017

Done! 3.8.0 is published.

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

2 participants