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

less-plugin-clean-css

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

less-plugin-clean-css - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

lib/parse-options.js

44

lib/clean-css-processor.js

@@ -6,3 +6,3 @@ var CleanCSS = require('clean-css'),

function CleanCSSProcessor(options) {
this.options = this.interpretOptions(options);
this.options = options || {};
};

@@ -12,3 +12,3 @@

process: function (css) {
var options = this.options || {};
var options = this.options;

@@ -25,42 +25,2 @@ if (options.keepSpecialComments === undefined) {

return new CleanCSS(options).minify(css);
},
interpretOptions: function(options) {
if (typeof options === 'string') {
var cleanOptionArgs = options.split(" ");
options = {};
for(var i = 0; i < cleanOptionArgs.length; i++) {
var argSplit = cleanOptionArgs[i].split("="),
argName = argSplit[0].replace(/^-+/,"");
switch(argName) {
case "keep-line-breaks":
case "b":
options.keepBreaks = true;
break;
case "s0":
options.keepSpecialComments = 0;
break;
case "s1":
options.keepSpecialComments = 1;
break;
// for compatibility - does nothing
case "skip-advanced":
options.noAdvanced = true;
break;
case "advanced":
options.noAdvanced = false;
break;
case "compatibility":
options.compatibility = argSplit[1];
break;
case "rounding-precision":
options.roundingPrecision = Number(argSplit[1]);
break;
default:
console.log("unrecognised clean-css option '" + argSplit[0] + "'");
usage.printOptions();
throw new Error();
}
}
}
return options;
}

@@ -67,0 +27,0 @@ };

var getCleanCSSProcessor = require("./clean-css-processor"),
usage = require("./usage");
usage = require("./usage"),
parseOptions = require("./parse-options");
module.exports = {
install: function(less, pluginManager, options) {
install: function(less, pluginManager) {
var CleanCSSProcessor = getCleanCSSProcessor(less);
pluginManager.addPostProcessor(new CleanCSSProcessor(options));
pluginManager.addPostProcessor(new CleanCSSProcessor(this.options));
},

@@ -12,3 +13,6 @@ printUsage: function () {

},
setOptions: function(options) {
this.options = parseOptions(options);
},
minVersion: [2, 0, 0]
};
{
"name": "less-plugin-clean-css",
"version": "1.0.0",
"version": "1.1.0",
"description": "clean-css plugin for less.js",

@@ -5,0 +5,0 @@ "homepage": "http://lesscss.org",

@@ -1,4 +0,33 @@

less-plugin-cleancss
====================
[![NPM version](https://badge.fury.io/js/less-plugin-clean-css.svg)](http://badge.fury.io/js/less-plugin-clean-css) [![Dependencies](https://david-dm.org/less/less-plugin-clean-css.svg)](https://david-dm.org/less/less-plugin-clean-css) [![devDependency Status](https://david-dm.org/less/less-plugin-clean-css/dev-status.svg)](https://david-dm.org/less/less-plugin-clean-css#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less-plugin-clean-css/optional-status.svg)](https://david-dm.org/less/less-plugin-clean-css#info=optionalDependencies)
Post-processes the css and compresses it
less-plugin-clean-css
=====================
Compresses the css output from less using clean-css.
## lessc usage
```
npm install -g less-plugin-clean-css
```
and then on the command line,
```
lessc file.less --clean-css="--advanced --compatibility=ie8"
```
See [clean-css](https://github.com/jakubpawlowicz/clean-css) for the available command options - the only difference is advanced which we default to false, because it is not always entirely safe.
## Programmatic usage
```
var LessPluginCleanCSS = require('less-plugin-clean-css'),
cleanCSSPlugin = new LessPluginCleanCSS({advanced: true});
less.render(lessString, { plugins: [cleanCSSPlugin] })
.then(
```
## Browser usage
Browser usage is not supported at this time.

Sorry, the diff of this file is not supported yet

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