-
Notifications
You must be signed in to change notification settings - Fork 130
Act more like a fallback #64
Comments
For those cases I don't think there is a benefit to acting as a fallback? Since the values don't change at runtime in those cases, so it would just be duplicate code? |
It's a bit like having prefixed & non prefixed version. And for example Firefox 31+ already support custom property (so variables too), this will be nice to be able to debug in the inspector using variable name & not "rendered" version. |
Setting `preserve` to `true` will preserve `calc()` in the output, so that they can be used by supporting browsers. Useful now that browsers are starting to implement vars (eg Firefox 31+) & it’s even better for debug [to see real rules](http://cl.ly/image/3W3O0E41173X). I’ve refactored the code a little bit to make it easier to use the `options.preserve` in the main function (& also use rework-visit which is more bullet proof). This should be a major update since now calc need to be called as a function (like rework-vars for example) to be able to pass options. So this should be tagged as 0.3 (or maybe it’s time to ship 1.0 :) ?) I also quickly refactor tests to make it more understandable (plugins.js near preserve.css was confusing imo). I hope it’s ok. FWI, I did this since I’m more seeing rework-vars & rework-calc as fallback than replacement. See reworkcss/rework-vars#28 reworkcss/rework-vars#29 & segmentio/myth#64
Here is why I would like to be able to use myth as a fallback (at least during debug ?) rework-vars & rework-calc have PRs (reworkcss/rework-vars#29 & reworkcss/rework-calc#3) & that hopefully will be merged should soon. |
Interesting, yeah I think I'd be down for a pull request. It might be something we want to put behind a flags like |
Sure. What about |
Setting `preserve` to `true` will preserve `calc()` in the output, so that they can be used by supporting browsers. Useful now that browsers are starting to implement vars (eg Firefox 31+) & it’s even better for debug [to see real rules](http://cl.ly/image/3W3O0E41173X). I’ve refactored the code a little bit to make it easier to use the `preserve` in the main function (& also use rework-visit which is more bullet proof) like rework-vars. This should be a major update since now calc need to be called as a function (like rework-vars for example) to be able to pass options. So this should be tagged as 0.3 (or maybe it’s time to ship 1.0 :) ?) I also quickly refactor tests to make it more understandable (plugins.js near preserve.css was confusing imo). I also add some error reporting like we have in rework-vars. Btw, maybe we can expand the use of balanced-match to rewrite other parts of the plugin. I hope it’s ok. FWI, I did this since I’m more seeing rework-vars & rework-calc as fallback than replacement. See reworkcss/rework-vars#28 reworkcss/rework-vars#29 & segmentio/myth#64
Edit: let's go for it
What about adding the possibility to keep original sources & just add rules as fallback before the other ?
If I take you example on the homepage:
should yield into
but instead give (note that the homepage include
:root
in the output while it's not here)The text was updated successfully, but these errors were encountered: