Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-discard-comments

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-discard-comments - npm Package Compare versions

Comparing version 1.2.1 to 2.0.0

4

CHANGELOG.md

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc