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

I dont know why toRemove return undefined #800

Closed
zodman opened this issue Jul 28, 2016 · 9 comments
Closed

I dont know why toRemove return undefined #800

zodman opened this issue Jul 28, 2016 · 9 comments

Comments

@zodman
Copy link

zodman commented Jul 28, 2016

at

https://github.com/jakubpawlowicz/clean-css/blob/master/lib/properties/optimizer.js#L133

i fix with:

if ( typeof(toRemove) != 'undefined') {
    var longhandToShorthand = toRemove.name != _name;
} else {    
 continue;
}

@jakubpawlowicz
Copy link
Collaborator

It certainly should not be undefined, so your code snippet is worth having. However a reproducible test case would definitely be great to have - see https://github.com/jakubpawlowicz/clean-css/blob/master/CONTRIBUTING.md#pull-requests

@analytik
Copy link

analytik commented Sep 20, 2016

Seems to work in Node.js v4.4.x, but is broken in 6.0, 6.5, 6.6 and possibly others. Tested on Windows 10 x64 and Debian x64.

@acidjazz
Copy link

acidjazz commented Nov 1, 2016

confirmed w/ v6.9.1

/Users/k/256/node_modules/clean-css/lib/properties/optimizer.js:134
var longhandToShorthand = toRemove.name != _name;
^

TypeError: Cannot read property 'name' of undefined
at _optimize (/Users/k/256/node_modules/clean-css/lib/properties/optimizer.js:134:43)
at optimize (/Users/k/256/node_modules/clean-css/lib/properties/optimizer.js:198:3)
at recursivelyOptimizeProperties (/Users/k/256/node_modules/clean-css/lib/selectors/advanced.js:51:9)
at optimize (/Users/k/256/node_modules/clean-css/lib/selectors/advanced.js:61:3)
at minify (/Users/k/256/node_modules/clean-css/lib/clean.js:228:5)
at whenSourceMapReady (/Users/k/256/node_modules/clean-css/lib/clean.js:135:7)
at Object.whenDone (/Users/k/256/node_modules/clean-css/lib/clean.js:155:14)
at processNext (/Users/k/256/node_modules/clean-css/lib/imports/inliner.js:105:13)
at importFrom (/Users/k/256/node_modules/clean-css/lib/imports/inliner.js:79:10)
at ImportInliner.process (/Users/k/256/node_modules/clean-css/lib/imports/inliner.js:38:10)
at /Users/k/256/node_modules/clean-css/lib/clean.js:120:41
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

@jakubpawlowicz
Copy link
Collaborator

Again, it'd be great to have a reproducible test case, like a CSS snippet causing it.

@jakubpawlowicz
Copy link
Collaborator

Depends on #290 - aggressive merging should be out in 4.0.

@jakubpawlowicz jakubpawlowicz added this to the 4.0 milestone Jan 4, 2017
@zodman
Copy link
Author

zodman commented Jan 12, 2017

@jakubpawlowicz i had a problem can you adviceme how to find the css that causing it ? a try with a lot printing values but no found the snippet

@jakubpawlowicz
Copy link
Collaborator

@zodman I'd start with printing properties first at https://github.com/jakubpawlowicz/clean-css/blob/3.4/lib/properties/optimizer.js#L133 and that should give you a clue what to look for.

Btw, you can also ditch aggressive merging altogether (--skip-aggressive-merging / aggressiveMerging: false) as it'll be gone in 4.0.

@zodman
Copy link
Author

zodman commented Jan 12, 2017

for some reason my gulpfile are minify a js file ...

stupid code!! long bug closed!

@zodman zodman closed this as completed Jan 12, 2017
@jakubpawlowicz
Copy link
Collaborator

no worries 👍 glad you sorted it out

@jakubpawlowicz jakubpawlowicz removed this from the 4.0 milestone Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants