We need to change node#clone to produce an exact copy of a node. Otherwise plugin authors are going to keep extracting out what should be parser methods into their own repositories (https://github.com/ben-eb/postcss-merge-rules/blob/master/lib/clone.js, https://github.com/postcss/autoprefixer-core/blob/master/lib/prefixer.coffee#L6-L21), or worse, not realising that:
String(node) !== String(node.clone())
Please, let's end this fragmentation.
I agree. I think we should change all clone and before/after login in 5.0.
+1
I am already doing shit for postcss-import.
This is somewhat related: https://github.com/ben-eb/cssnano/pull/42
I would rather not have to write code that tidies up after other plugins. https://github.com/ben-eb/cssnano/blob/issue-26/lib/styleCache.js
Yeap, I think to fix this issue in 6.0/7.0 with raw properties refactoring.
I'm going to try a different tack here, as I still don't like the duplication of this utility across the modules that I use it in. Can we add a new method, cloneExact which performs this behaviour, and deprecate it once we fix the actual clone method? This way I can rely on PostCSS again to clone nodes without having to write my own clone utility.
I can send a patch for this if you think it's a good idea.
@ben-eb maybe we should release 6.0 in next week? Remove deprecated code and fix clone?
Is there any sort of ETA for 6.0? (I'm guessing it's not next week anymore.)
@bb010g ouh :D honestly, not in first half of 2017 — I am working on Logux.
What problem do you have? Maybe I could help you.
@ai It's a blocker for postcss/postcss-import#206. Not the end of the world, but it would be nice to see it fixed at some point.
This issue is blocking usage of stylelint and postcss-browser-reporter. There are some important stylelint rules for our team "block-closing-brace-newline-after": "always", "block-closing-brace-newline-before": "always". If i add stylelint after import (gulp) it will trough an error, if it will before it won't lint all css files as there is escape pattern for some files which are imported into main files. Meanwhile workaround is separate gulp task which lints all css files but postcss-browser-reporter can't be intagrated in proper way.
Done b84cdb1
Most helpful comment
Done b84cdb1