summaryrefslogtreecommitdiffstatshomepage
path: root/core/scripts/css/remove-unwanted-comments.js
diff options
context:
space:
mode:
authorxjm <xjm@65776.no-reply.drupal.org>2023-01-05 17:55:43 -0600
committerxjm <xjm@65776.no-reply.drupal.org>2023-01-05 17:55:43 -0600
commit83f1d40d033bae41d10d6f32964f4b67213bf83d (patch)
tree65e55a02979eadc8c4af8daa8f8fc9017c8d88c7 /core/scripts/css/remove-unwanted-comments.js
parent2d12ec2326a187e10414ec754562d83b15f7d7d4 (diff)
downloaddrupal-83f1d40d033bae41d10d6f32964f4b67213bf83d.tar.gz
drupal-83f1d40d033bae41d10d6f32964f4b67213bf83d.zip
Issue #3308872 by Spokje, xjm, longwave, bnjmnm: Address "postcss.plugin was deprecated" warning
Diffstat (limited to 'core/scripts/css/remove-unwanted-comments.js')
-rw-r--r--core/scripts/css/remove-unwanted-comments.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/scripts/css/remove-unwanted-comments.js b/core/scripts/css/remove-unwanted-comments.js
new file mode 100644
index 00000000000..bedbb347977
--- /dev/null
+++ b/core/scripts/css/remove-unwanted-comments.js
@@ -0,0 +1,14 @@
+// On import, remove the comments, so they don't appear as useless comments at the top of the autogenerated css files.
+module.exports = opts => {
+ return {
+ postcssPlugin: 'remove-unwanted-comments',
+ Once(css) {
+ css.walk(node => {
+ if (node.type === 'comment') {
+ node.remove();
+ }
+ })
+ }
+ }
+}
+module.exports.postcss = true