Skip to content

Commit 19c7f4b

Browse files
authored
Merge pull request #19 from XhmikosR/master
Minor tweaks and cleanup
2 parents b405348 + d6a6c08 commit 19c7f4b

File tree

6 files changed

+54
-56
lines changed

6 files changed

+54
-56
lines changed

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
[![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)
1+
[![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)
22

3-
less-plugin-clean-css
4-
=====================
3+
# less-plugin-clean-css
54

65
Compresses the css output from less using clean-css.
76

@@ -21,7 +20,7 @@ See [clean-css](https://github.com/jakubpawlowicz/clean-css) for the available c
2120

2221
## Programmatic usage
2322

24-
```
23+
```js
2524
var LessPluginCleanCSS = require('less-plugin-clean-css'),
2625
cleanCSSPlugin = new LessPluginCleanCSS({advanced: true});
2726
less.render(lessString, { plugins: [cleanCSSPlugin] })

lib/clean-css-processor.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
var CleanCSS = require('clean-css'),
2-
usage = require("./usage");
1+
"use strict";
32

4-
module.exports = function(less) {
3+
var CleanCSS = require("clean-css");
4+
5+
module.exports = function() {
56
function CleanCSSProcessor(options) {
67
this.options = options || {};
7-
};
8+
}
89

910
CleanCSSProcessor.prototype = {
1011
process: function (css, extra) {
@@ -24,25 +25,24 @@ module.exports = function(less) {
2425
}
2526
}
2627

27-
if (options.keepSpecialComments === undefined) {
28+
if (typeof options.keepSpecialComments === "undefined") {
2829
options.keepSpecialComments = "*";
2930
}
3031
options.processImport = false;
3132

32-
if (options.rebase === undefined) {
33+
if (typeof options.rebase === "undefined") {
3334
options.rebase = false;
3435
}
3536

36-
if (options.advanced === undefined) {
37+
if (typeof options.advanced === "undefined") {
3738
options.advanced = false;
3839
}
3940

4041
var output = new CleanCSS(options).minify(css);
4142

4243
if (sourceMap) {
4344
if (sourcesContent) {
44-
for(var source = 0; source < sources.length; source++)
45-
{
45+
for (var source = 0; source < sources.length; source++) {
4646
output.sourceMap.setSourceContent(sources[source], sourcesContent[source]);
4747
}
4848
}

lib/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
"use strict";
2+
13
var getCleanCSSProcessor = require("./clean-css-processor"),
24
usage = require("./usage"),
35
parseOptions = require("./parse-options");
46

57
function LessPluginCleanCSS(options) {
68
this.options = options;
7-
};
9+
}
810

911
LessPluginCleanCSS.prototype = {
1012
install: function(less, pluginManager) {

lib/parse-options.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
"use strict";
2+
13
module.exports = function(options) {
2-
if (typeof options === 'string') {
4+
if (typeof options === "string") {
35
var cleanOptionArgs = options.split(" ");
46
options = {};
5-
for(var i = 0; i < cleanOptionArgs.length; i++) {
7+
8+
for (var i = 0; i < cleanOptionArgs.length; i++) {
69
var argSplit = cleanOptionArgs[i].split("="),
7-
argName = argSplit[0].replace(/^-+/,"");
8-
switch(argName) {
10+
argName = argSplit[0].replace(/^-+/, "");
11+
12+
switch (argName) {
913
case "keep-line-breaks":
1014
case "b":
1115
options.keepBreaks = true;

lib/usage.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
module.exports = {
24
printUsage: function() {
35
console.log("");
@@ -14,6 +16,6 @@ module.exports = {
1416
printOptions: function() {
1517
console.log("we support the following arguments... 'keep-line-breaks', 'b'");
1618
console.log("'s0', 's1', 'advanced', 'rebase', 'keepSpecialComments', compatibility', 'rounding-precision'");
17-
console.log("'skip-aggressive-merging', 'skip-shorthand-compacting'")
19+
console.log("'skip-aggressive-merging', 'skip-shorthand-compacting'");
1820
}
1921
};

package.json

+28-37
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,30 @@
11
{
2-
"name": "less-plugin-clean-css",
3-
"version": "1.5.1",
4-
"description": "clean-css plugin for less.js",
5-
"homepage": "http://lesscss.org",
6-
"author": {
7-
"name": "Luke Page"
8-
},
9-
"contributors": [
10-
"The Core Less Team"
11-
],
12-
"bugs": {
13-
"url": "https://github.com/less/less-plugin-clean-css/issues"
14-
},
15-
"repository": {
16-
"type": "git",
17-
"url": "https://github.com/less/less-plugin-clean-css.git"
18-
},
19-
"licenses": [
20-
{
21-
"type": "Apache v2",
22-
"url": "https://github.com/less/less-plugin-clean-css/blob/master/LICENSE"
23-
}
24-
],
25-
"main": "lib/index.js",
26-
"engines": {
27-
"node": ">=0.4.2"
28-
},
29-
"dependencies": {
30-
"clean-css": "^3.0.1"
31-
},
32-
"devDependencies": {
33-
},
34-
"keywords": [
35-
"less plugins",
36-
"cleancss",
37-
"less compression"
38-
]
2+
"name": "less-plugin-clean-css",
3+
"version": "1.5.1",
4+
"description": "clean-css plugin for less.js",
5+
"homepage": "http://lesscss.org",
6+
"author": "Luke Page",
7+
"contributors": [
8+
"The Core Less Team"
9+
],
10+
"bugs": {
11+
"url": "https://github.com/less/less-plugin-clean-css/issues"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/less/less-plugin-clean-css.git"
16+
},
17+
"license": "Apache-2.0",
18+
"main": "lib/index.js",
19+
"engines": {
20+
"node": ">=0.10"
21+
},
22+
"dependencies": {
23+
"clean-css": "^3.0.1"
24+
},
25+
"keywords": [
26+
"less plugins",
27+
"cleancss",
28+
"less compression"
29+
]
3930
}

0 commit comments

Comments
 (0)