postcss-discard-comments
Advanced tools
Comparing version 1.2.1 to 2.0.0
@@ -0,1 +1,5 @@ | ||
# 2.0.0 | ||
* Upgraded to PostCSS 5 (thanks to @avanes). | ||
# 1.2.1 | ||
@@ -2,0 +6,0 @@ |
38
index.js
@@ -30,24 +30,24 @@ 'use strict'; | ||
css.eachInside(function (node) { | ||
css.walk(function (node) { | ||
if (node.type === 'comment' && remover.canRemove(node.text)) { | ||
return node.removeSelf(); | ||
return node.remove(); | ||
} | ||
if (node.between) { | ||
node.between = replaceComments(node.between); | ||
if (node.raws.between) { | ||
node.raws.between = replaceComments(node.raws.between); | ||
} | ||
if (node.type === 'decl') { | ||
if (node._value && node._value.raw) { | ||
var replaced = replaceComments(node._value.raw); | ||
node._value.raw = node._value.value = node.value = replaced; | ||
if (node.raws.value && node.raws.value.raw) { | ||
var replaced = replaceComments(node.raws.value.raw); | ||
node.raws.value.raw = node.raws.value.value = node.value = replaced; | ||
} | ||
if (node._important) { | ||
node._important = replaceComments(node._important); | ||
if (node.raws.important) { | ||
node.raws.important = replaceComments(node.raws.important); | ||
var b = balanced.matches({ | ||
source: node._important, | ||
source: node.raws.important, | ||
open: '/*', | ||
close: '*/' | ||
}); | ||
node._important = b.length ? node._important : '!important'; | ||
node.raws.important = b.length ? node.raws.important : '!important'; | ||
} | ||
@@ -57,4 +57,4 @@ return; | ||
if (node.type === 'rule' && node._selector && node._selector.raw) { | ||
node._selector.raw = replaceComments(node._selector.raw); | ||
if (node.type === 'rule' && node.raws.selector && node.raws.selector.raw) { | ||
node.raws.selector.raw = replaceComments(node.raws.selector.raw); | ||
return; | ||
@@ -64,12 +64,12 @@ } | ||
if (node.type === 'atrule') { | ||
if (node.afterName) { | ||
var commentsReplaced = replaceComments(node.afterName); | ||
if (node.raws.afterName) { | ||
var commentsReplaced = replaceComments(node.raws.afterName); | ||
if (!commentsReplaced.length) { | ||
node.afterName = commentsReplaced + ' '; | ||
node.raws.afterName = commentsReplaced + ' '; | ||
} else { | ||
node.afterName = ' ' + commentsReplaced + ' '; | ||
node.raws.afterName = ' ' + commentsReplaced + ' '; | ||
} | ||
} | ||
if (node._params && node._params.raw) { | ||
node._params.raw = replaceComments(node._params.raw); | ||
if (node.raws.params && node.raws.params.raw) { | ||
node.raws.params.raw = replaceComments(node.raws.params.raw); | ||
} | ||
@@ -76,0 +76,0 @@ } |
{ | ||
"name": "postcss-discard-comments", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "Discard comments in your CSS files with PostCSS.", | ||
@@ -17,4 +17,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tap-spec": "^4.0.2", | ||
"tape": "^4.1.0" | ||
"tap-spec": "^4.1.0", | ||
"tape": "^4.2.0" | ||
}, | ||
@@ -33,4 +33,4 @@ "homepage": "https://github.com/ben-eb/postcss-discard-comments", | ||
"node-balanced": "0.0.14", | ||
"postcss": "^4.1.16" | ||
"postcss": "^5.0.4" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9318
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@1.0.0(transitive)
+ Addedjs-base64@2.6.4(transitive)
+ Addedpostcss@5.2.18(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.03.2.3(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedes6-promise@2.3.0(transitive)
- Removedjs-base64@2.1.9(transitive)
- Removedpostcss@4.1.16(transitive)
- Removedsource-map@0.4.4(transitive)
Updatedpostcss@^5.0.4