Unable to parse multiple rules with plugin on Windows
Hi,
I've been using your plugin in a Windows environment (I do not have access to Mac or Unix/Linux at present) - I've come across an odd issue though:
If I add one rule to a style sheet, such as this one:
.slide-up + label {
display: inline-block;
position: absolute;
translate: translateX(0);
top: 0;
left: -2px;
padding: 10px 15px;
text-shadow: 0 1px 0 rgba(19, 74, 70, 0.4);
transition: all .3s ease-in-out;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
overflow: hidden;
}
...the code compiles absolutely fine. However, when adding a second or multiple additional rules, it falls over with this error:
C:\wamp\www\postcss>gulp styles
[16:04:54] Using gulpfile C:\wamp\www\postcss\gulpfile.js
[16:04:54] Starting 'styles'...
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Cannot set property 'value' of undefined
at C:\wamp\www\postcss\node_modules\postcss-transform-shortcut\index.js:44:20
at C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\container.js:115:34
at C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\container.js:73:26
at Root.each (C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\container.j
s:59:22)
at Root.walk (C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\container.j
s:72:21)
at Root.walkRules (C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\contai
ner.js:113:25)
at C:\wamp\www\postcss\node_modules\postcss-transform-shortcut\index.js:15:7
at LazyResult.run (C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-r
esult.js:201:20)
at C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:115:37
at LazyResult.asyncTick (C:\wamp\www\postcss\node_modules\gulp-postcss\node_modules\postcss\lib\
lazy-result.js:129:15)
Removing the additional rules and recompiling the code works fine.
I've tried changing the order and making sure that each rule applies to one selector or class (and not be assigned to multiple selectors at the same time time, such as .foo, .bar {....}. This has not made any difference - the code still fails to compile. I'm using Sublime Text 3 - the line endings have been set to Windows and Unix - neither of these make a difference either! I've also reduced the tasks being called in my gulpfile down to just one (the var references to plugins have been left untouched) - this doesn't make any difference.
Any ideas? My hope is I am just missing something - I'm not sure what though...
@alexlibby I've encountered the exact same issue. And I have it fixed in my fork. Maybe you'll want to go take a look.
And my fork should also have #3 fixed.
Here's the commit https://github.com/pc035860/postcss-transform-shortcut/commit/07af8a78d1fb5e7fdeebc8c7f56c0c9ecdd83efb
@pc035860 - you are a life saver - thankyou!
I'm running some tests now - so far, it all looks good from here; I will post back if I find any issue ;-)
EDIT: The code worked perfectly for me - can you please create this as a PR that can be committed to source? For anyone else who has this issue, you can copy the content's of @pc035860's version of index.js over the top of your local installation; this should get you working...