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

inline: ['remote'] is not working when multiple files are processed #966

Closed
lubomirblazekcz opened this issue Aug 18, 2017 · 2 comments
Closed
Labels

Comments

@lubomirblazekcz
Copy link

https://github.com/jakubpawlowicz/clean-css#how-to-optimize-multiple-files and https://github.com/jakubpawlowicz/clean-css#how-to-process-remote-imports-correctly does not work together, it throws this error:

C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\optimizer\level-1\optimize.js:628
    switch (token[0]) {
                 ^

TypeError: Cannot read property '0' of undefined
    at level1Optimize (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\optimizer\level-1\o
ptimize.js:628:18)
    at optimize (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\clean.js:128:5)
    at C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\clean.js:104:29
    at C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\read-sources.js:26:64
    at loadOriginalSources (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\load-or
iginal-sources.js:26:5)
    at C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\read-sources.js:26:14
    at applySourceMaps (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\apply-sourc
e-maps.js:34:5)
    at Object.callback (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\read-source
s.js:25:12)
    at doInlineImports (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\read-source
s.js:200:25)
    at inlineLocalStylesheet (C:\Users\Administrator\Desktop\test\node_modules\clean-css\lib\reader\read-
sources.js:327:10)

Environment

  • clean-css version - npm ls clean-css: 4.1.7
  • node.js version - node -v: 6.11.2
  • operating system: Windows 10

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
  inline: ['all']
}).minify({
  'path/to/file/one': {
    styles: '@import url(https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css);'
  },
  'path/to/file/two': {
    styles: '@import url(https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css);'
  }
}, function (error, output) {
  console.log(output.styles);
})
@jakubpawlowicz
Copy link
Collaborator

I can see it too. There seems to be a problem when mixing local and remote imports. Fix is coming!

jakubpawlowicz added a commit that referenced this issue Sep 2, 2017
This is an edge case when local `@import` was given by hash and
referenced a remote one which was processed synchronously but should
have been asynchronously.
jakubpawlowicz added a commit that referenced this issue Sep 2, 2017
This is an edge case when local `@import` was given by hash and
referenced a remote one which was processed synchronously but should
have been asynchronously.
@jakubpawlowicz
Copy link
Collaborator

This is fixed in 4.1.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants