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

background crashes clean-css #4

Open
vmarkovtsev opened this issue Mar 30, 2015 · 1 comment
Open

background crashes clean-css #4

vmarkovtsev opened this issue Mar 30, 2015 · 1 comment

Comments

@vmarkovtsev
Copy link

shrthnd seems to mess up background in some cases.

How I test

fs = require('fs');
fs.readFile('bootstrap.css', 'utf8', function (err,data) {
  var source = data;
  var shrthnd = require('shrthnd');
  source = shrthnd(source).string;
  var cleancss = require('clean-css');
  var minified = new cleancss().minify(source).styles;
});

Reduced test case

Part of Bootstrap 3.3.4.

.progress-striped .progress-bar,
.progress-bar-striped {
  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
  background-image:      -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
  background-image:         linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
  -webkit-background-size: 40px 40px;
          background-size: 40px 40px;
}

Occuring error

/tmp/shrthnd/node_modules/clean-css/lib/properties/validator.js:135
      if (s.indexOf('/') < 0)
           ^
TypeError: Cannot read property 'indexOf' of undefined
    at Object.module.exports.validator.isValidBackgroundPositionAndSize (/tmp/shrthnd/node_modules/clean-css/lib/properties/validator.js:135:12)
    at module.exports.breakUp.background (/tmp/shrthnd/node_modules/clean-css/lib/properties/processable.js:239:28)
    at Object.breakUp (/tmp/shrthnd/node_modules/clean-css/lib/properties/processable.js:153:25)
    at Token.tokenizeOne (/tmp/shrthnd/node_modules/clean-css/lib/properties/token.js:93:47)
    at Array.map (native)
    at Function.Token.tokenize (/tmp/shrthnd/node_modules/clean-css/lib/properties/token.js:105:26)
    at Optimizer.compact (/tmp/shrthnd/node_modules/clean-css/lib/properties/optimizer.js:258:24)
    at Object.Optimizer.process (/tmp/shrthnd/node_modules/clean-css/lib/properties/optimizer.js:274:9)
    at optimizeProperties (/tmp/shrthnd/node_modules/clean-css/lib/selectors/optimizers/advanced.js:711:27)
    at _optimize (/tmp/shrthnd/node_modules/clean-css/lib/selectors/optimizers/advanced.js:730:5)

shrthnd output

.progress-striped .progress-bar,
.progress-bar-striped {
  background: linear-gradient(45deg, rgba(255, 255, 255, .15) 25% 0 0/40px 40px, transparent 25% 0 0/40px 40px, transparent 50% 0 0/40px 40px, rgba(255, 255, 255, .15) 50% 0 0/40px 40px, rgba(255, 255, 255, .15) 75% 0 0/40px 40px, transparent 75% 0 0/40px 40px, transparent) 0 0/40px 40px;
  -webkit-background-size: 40px 40px;
}
@wottpal
Copy link

wottpal commented Nov 16, 2015

Same issue here

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