postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
596 stars 77 forks source link

hotfix wrong regex #95

Closed jrweb247 closed 6 years ago

jonathantneal commented 6 years ago

Please provide more information. Why are you changing this?

The current RegExp does not require a fallback to be specified and you have changed that.

jonathantneal commented 6 years ago

I also see the tests are failing. We can reopen this if you provide some information.

jrweb247 commented 6 years ago

https://regex101.com/r/sPI23e/2 doesn't work anymore

with de PR :

https://regex101.com/r/sPI23e/3

jonathantneal commented 6 years ago

@jrweb247, the RegExp is not used to capture the whole declaration, including its property and value.

See: https://github.com/postcss/postcss-custom-properties/blob/master/index.js#L7

And note the comment (that has not been changed in 6.3.0):

// matches `name[, fallback]`, captures "name" and "fallback"

This matcher is used on L50 on matches.body, which is everything within the parentheses of the var().

Better text to test would be grey and grey, fallback.

jrweb247 commented 6 years ago

sorry it's difficult to write in english but your last release 6.3.0 break our production deployement, I think it's because the regex, because before and after the regex doesn't match same things see:

https://regex101.com/r/aNEo6B/1

jonathantneal commented 6 years ago

@jrweb247, have you tried 6.3.1? See #93

jrweb247 commented 6 years ago

sorry 6.3.0 was removed ? can't see 6.3.1 :-(

jonathantneal commented 6 years ago

https://www.npmjs.com/package/postcss-custom-properties