Error when using inline:['all'] for imports
lubomirblazekcz opened this issue · 4 comments
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)
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?
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
@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!