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

cssnano

Package Overview
Dependencies
Maintainers
2
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssnano - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# 3.1.0
* This release swaps postcss-single-charset for postcss-normalize-charset,
which can detect encoding to determine whether a charset is necessary.
Optionally, you can set the `add` option to `true` to prepend a UTF-8
charset to the output automatically (thanks to @TrySound).
* A `safe` option was added, which disables more aggressive optimisations, as
a convenient preset configuration (thanks to @TrySound).
# 3.0.3

@@ -2,0 +11,0 @@

64

index.js

@@ -5,2 +5,3 @@ 'use strict';

var defined = require('defined');
var assign = require('object-assign');
var postcss = require('postcss');

@@ -23,3 +24,3 @@ var warnOnce = require('./lib/warnOnce');

postcssMinifyParams: require('postcss-minify-params'),
postcssSingleCharset: require('postcss-single-charset'),
postcssNormalizeCharset: require('postcss-normalize-charset'),
// minify-font-values should be run before discard-unused

@@ -44,9 +45,32 @@ postcssMinifyFontValues: require('postcss-minify-font-values'),

var defaultOptions = {
autoprefixer: {
add: false
},
postcssNormalizeCharset: {
add: false
}
};
var safeOptions = {
postcssConvertValues: {
length: false
},
postcssDiscardUnused: {
disable: true
},
postcssReduceIdents: {
counterStyle: false,
keyframes: false
},
postcssZindex: {
disable: true
}
};
var cssnano = postcss.plugin('cssnano', function (options) {
options = options || {};
var safe = options.safe === true;
var proc = postcss();
var plugins = Object.keys(processors);
var len = plugins.length;
var i = 0;

@@ -61,7 +85,9 @@ if (typeof options.fontFamily !== 'undefined' || typeof options.minifyFontWeight !== 'undefined') {

while (i < len) {
var plugin = plugins[i++];
var processor = processors[plugin];
var method = processor;
if (typeof options.singleCharset !== 'undefined') {
warnOnce('The singleCharset option has been renamed to ' +
'normalizeCharset, and is now deprecated.');
options.normalizeCharset = options.singleCharset;
}
Object.keys(processors).forEach(function (plugin) {
var shortName = plugin.replace('postcss', '');

@@ -73,16 +99,22 @@ shortName = shortName.slice(0, 1).toLowerCase() + shortName.slice(1);

options[plugin],
options[decamelize(plugin, '-')],
{}
options[decamelize(plugin, '-')]
);
if (opts === false || opts.disable) {
continue;
if (opts === false) {
opts = {
disable: true
};
}
if (plugin === 'autoprefixer') {
opts.add = false;
opts = assign({},
defaultOptions[plugin],
safe ? safeOptions[plugin] : null,
opts
);
if (!opts.disable) {
proc.use(processors[plugin](opts));
}
proc.use(method(opts));
}
});

@@ -89,0 +121,0 @@ return proc;

@@ -13,2 +13,3 @@ 'use strict';

css.walkDecls(function (decl) {
decl.value = decl.value.trim();
// Ensure that !important values do not have any excess whitespace

@@ -15,0 +16,0 @@ if (decl.important) {

@@ -6,3 +6,3 @@ 'use strict';

function filterOptimiser(decl) {
function filterOptimiser (decl) {
decl.value = parser(decl.value).walk(function (node) {

@@ -9,0 +9,0 @@ if (node.type === 'function') {

@@ -6,3 +6,5 @@ 'use strict';

module.exports = function warnOnce (message) {
if (messages[message]) { return; }
if (messages[message]) {
return;
}
messages[message] = true;

@@ -9,0 +11,0 @@ if (typeof console !== 'undefined' && console.warn) {

{
"name": "cssnano",
"version": "3.0.3",
"version": "3.1.0",
"description": "A modular minifier, built on top of the PostCSS ecosystem.",

@@ -8,2 +8,3 @@ "main": "index.js",

"bench": "tape benchmark/index.js",
"lint": "eslint index.js lib tests",
"test-integrations": "tape tests/integrations.js",

@@ -13,3 +14,3 @@ "test-fixtures": "tape tests/fixtures.js | tap-spec",

"test-webpack": "tape tests/webpack.js | tap-spec",
"test": "tape tests/*.js | tap-spec"
"test": "npm run lint && tape tests/*.js | tap-spec"
},

@@ -31,10 +32,11 @@ "keywords": [

"indexes-of": "^1.0.1",
"object-assign": "^4.0.1",
"postcss": "^5.0.5",
"postcss-calc": "^5.0.0",
"postcss-colormin": "^2.1.1",
"postcss-convert-values": "^2.2.0",
"postcss-convert-values": "^2.2.1",
"postcss-discard-comments": "^2.0.0",
"postcss-discard-duplicates": "^2.0.0",
"postcss-discard-empty": "^2.0.0",
"postcss-discard-unused": "^2.0.0",
"postcss-discard-unused": "^2.1.0",
"postcss-filter-plugins": "^2.0.0",

@@ -47,12 +49,13 @@ "postcss-merge-idents": "^2.1.0",

"postcss-minify-selectors": "^2.0.0",
"postcss-normalize-charset": "^1.1.0",
"postcss-normalize-url": "^3.0.1",
"postcss-ordered-values": "^2.0.1",
"postcss-reduce-idents": "^2.2.0",
"postcss-single-charset": "^1.0.0",
"postcss-svgo": "^2.0.1",
"postcss-unique-selectors": "^2.0.0",
"postcss-value-parser": "^2.0.4",
"postcss-value-parser": "^2.0.5",
"postcss-zindex": "^2.0.0"
},
"devDependencies": {
"eslint": "^1.5.0",
"json-loader": "^0.5.3",

@@ -59,0 +62,0 @@ "node-libs-browser": "^0.5.3",

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