grunt-contrib-less
Advanced tools
Comparing version 0.12.0 to 1.0.0
{ | ||
"name": "grunt-contrib-less", | ||
"description": "Compile LESS files to CSS.", | ||
"version": "0.12.0", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-less", | ||
@@ -30,18 +30,17 @@ "author": { | ||
"dependencies": { | ||
"async": "^0.2.10", | ||
"async": "^0.9.0", | ||
"chalk": "^0.5.1", | ||
"less": "^1.7.2", | ||
"lodash": "^2.4.1", | ||
"maxmin": "^0.1.0" | ||
"less": "^2.1.0", | ||
"lodash": "^2.4.1" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "^0.9.2", | ||
"grunt-contrib-nodeunit": "^0.3.3", | ||
"grunt-contrib-clean": "^0.5.0", | ||
"grunt-contrib-internal": "^0.4.5", | ||
"grunt": "^0.4.4", | ||
"grunt-cli": "^0.1.13" | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-internal": "^0.4.11", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-nodeunit": "^0.4.1", | ||
"less-plugin-clean-css": "^1.2.0" | ||
}, | ||
"peerDependencies": { | ||
"grunt": "~0.4.0" | ||
"grunt": "~0.4.5" | ||
}, | ||
@@ -54,3 +53,4 @@ "keywords": [ | ||
"LICENSE-MIT" | ||
] | ||
], | ||
"appveyor_id": "e3aa4d07xe4w4u05" | ||
} |
105
README.md
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-less v0.12.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-less.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-less) <a href="https://ci.appveyor.com/project/gruntjs/grunt-contrib-less"><img src="https://ci.appveyor.com/api/projects/status/e3aa4d07xe4w4u05/branch/master" alt="Build Status: Windows" height="18" /></a> | ||
# grunt-contrib-less v1.0.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-less.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-less) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/e3aa4d07xe4w4u05/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-less/branch/master) | ||
@@ -8,3 +8,3 @@ > Compile LESS files to CSS. | ||
## Getting Started | ||
This plugin requires Grunt `~0.4.0` | ||
This plugin requires Grunt `~0.4.5` | ||
@@ -33,4 +33,3 @@ If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
#### paths | ||
Type: `String` `Array` `Function` | ||
Type: `String` `Array` `Function` | ||
Default: Directory of input file. | ||
@@ -43,11 +42,9 @@ | ||
#### rootpath | ||
Type: `String` | ||
Type: `String` | ||
Default: `""` | ||
A path to add on to the start of every url resource. | ||
A path to add on to the start of every URL resource. | ||
#### compress | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -57,26 +54,18 @@ | ||
#### cleancss | ||
Type: `Boolean` | ||
#### plugins | ||
Type: `Array` | ||
Default: `null` | ||
Default: `false` | ||
Allows passing plugins | ||
Compress output using [clean-css](https://npmjs.org/package/clean-css). | ||
#### cleancssOptions | ||
Type: `Object` | ||
Default: none | ||
#### ieCompat | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `true` | ||
Enforce the css output is compatible with Internet Explorer 8. | ||
Enforce the CSS output is compatible with Internet Explorer 8. | ||
For example, the [data-uri](https://github.com/cloudhead/less.js/pull/1086) function encodes a file in base64 encoding and embeds it into the generated CSS files as a data-URI. Because Internet Explorer 8 limits `data-uri`s to 32KB, the [ieCompat](https://github.com/cloudhead/less.js/pull/1190) option prevents `less` from exceeding this. | ||
For example, the [data-uri](http://lesscss.org/functions/#misc-functions-data-uri) function encodes a file in base64 encoding and embeds it into the generated CSS files as a data-URI. Because Internet Explorer 8 limits `data-uri`s to 32KB, the ieCompat option prevents `less` from exceeding this. | ||
#### optimization | ||
Type: `Integer` | ||
Type: `Integer` | ||
Default: `null` | ||
@@ -87,4 +76,3 @@ | ||
#### strictImports | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -95,4 +83,3 @@ | ||
#### strictMath | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -103,4 +90,3 @@ | ||
#### strictUnits | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -111,4 +97,3 @@ | ||
#### syncImport | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -119,4 +104,3 @@ | ||
#### dumpLineNumbers | ||
Type: `String` | ||
Type: `String` | ||
Default: `false` | ||
@@ -129,11 +113,9 @@ | ||
#### relativeUrls | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
Rewrite urls to be relative. false: do not modify urls. | ||
Rewrite URLs to be relative. false: do not modify URLs. | ||
#### customFunctions | ||
Type: `Object` | ||
Type: `Object` | ||
Default: none | ||
@@ -146,12 +128,4 @@ | ||
#### report | ||
Choices: `'min'`, `'gzip'` | ||
Default: `'min'` | ||
Either report only minification result or report minification and gzip results. | ||
This is useful to see exactly how well clean-css is performing but using `'gzip'` will make the task take 5-10x longer to complete. [Example output](https://github.com/sindresorhus/maxmin#readme). | ||
#### sourceMap | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -162,4 +136,3 @@ | ||
#### sourceMapFilename | ||
Type: `String` | ||
Type: `String` | ||
Default: none | ||
@@ -170,11 +143,9 @@ | ||
#### sourceMapURL | ||
Type: `String` | ||
Type: `String` | ||
Default: none | ||
Override the default url that points to the sourcemap from the compiled css file. | ||
Override the default URL that points to the source map from the compiled CSS file. | ||
#### sourceMapBasepath | ||
Type: `String` | ||
Type: `String` | ||
Default: none | ||
@@ -185,4 +156,3 @@ | ||
#### sourceMapRootpath | ||
Type: `String` | ||
Type: `String` | ||
Default: none | ||
@@ -193,4 +163,3 @@ | ||
#### outputSourceFiles | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: false | ||
@@ -201,11 +170,9 @@ | ||
#### modifyVars | ||
Type: `Object` | ||
Type: `Object` | ||
Default: none | ||
Overrides global variables. Equivalent to ```--modify-vars='VAR=VALUE'``` option in less. | ||
Overrides global variables. Equivalent to `--modify-vars='VAR=VALUE'` option in less. | ||
#### banner | ||
Type: `String` | ||
Type: `String` | ||
Default: none | ||
@@ -228,3 +195,6 @@ | ||
paths: ["assets/css"], | ||
cleancss: true, | ||
plugins: [ | ||
new require('less-plugin-autoprefix')({browsers: ["last 2 versions"]}), | ||
new require('less-plugin-clean-css')(cleanCssOptions) | ||
], | ||
modifyVars: { | ||
@@ -245,2 +215,3 @@ imgPath: '"http://mycdn.com/path/to/images"', | ||
* 2014-12-23 v1.0.0 Update to less 2.1.0 | ||
* 2014-10-23 v0.12.0 Added cleancssOptions as a option. When possible, includes filename for failed writes. Ensure banner only outputs on the first file in a series. | ||
@@ -279,2 +250,2 @@ * 2014-07-29 v0.11.4 Fix 'banner', 'urlArgs' LESS options Fixes npm 2 peerDependencies issues | ||
*This file was generated on Thu Oct 23 2014 11:56:56.* | ||
*This file was generated on Tue Dec 23 2014 14:52:06.* |
@@ -15,13 +15,5 @@ /* | ||
var chalk = require('chalk'); | ||
var maxmin = require('maxmin'); | ||
var less = require('less'); | ||
module.exports = function(grunt) { | ||
var lessOptions = { | ||
parse: ['paths', 'optimization', 'filename', 'strictImports', 'syncImport', 'dumpLineNumbers', 'relativeUrls', | ||
'rootpath'], | ||
render: ['compress', 'cleancss', 'cleancssOptions', 'ieCompat', 'strictMath', 'strictUnits', 'urlArgs', | ||
'sourceMap', 'sourceMapFilename', 'sourceMapURL', 'sourceMapBasepath', 'sourceMapRootpath', 'outputSourceFiles'] | ||
}; | ||
grunt.registerMultiTask('less', 'Compile LESS files to CSS', function() { | ||
@@ -31,3 +23,2 @@ var done = this.async(); | ||
var options = this.options({ | ||
report: 'min', | ||
banner: '' | ||
@@ -62,3 +53,3 @@ }); | ||
var compiledMax = [], compiledMin = []; | ||
var compiled = []; | ||
var i = 0; | ||
@@ -71,24 +62,25 @@ | ||
compileLess(file, options, function(css, err) { | ||
if (!err) { | ||
if (css.max) { | ||
compiledMax.push(css.max); | ||
compileLess(file, destFile, options) | ||
.then(function(output) { | ||
compiled.push(output.css); | ||
if (options.sourceMap && !options.sourceMapFileInline) { | ||
var sourceMapFilename = options.sourceMapFilename; | ||
if (!sourceMapFilename) { | ||
sourceMapFilename = destFile + '.map'; | ||
} | ||
grunt.file.write(sourceMapFilename, output.map); | ||
grunt.log.writeln('File ' + chalk.cyan(options.sourceMapFilename) + ' created.'); | ||
} | ||
compiledMin.push(css.min); | ||
process.nextTick(next); | ||
} else { | ||
}, | ||
function(err) { | ||
nextFileObj(err); | ||
} | ||
}, function (sourceMapContent) { | ||
grunt.file.write(options.sourceMapFilename, sourceMapContent); | ||
grunt.log.writeln('File ' + chalk.cyan(options.sourceMapFilename) + ' created.'); | ||
}); | ||
}); | ||
}, function() { | ||
if (compiledMin.length < 1) { | ||
if (compiled.length < 1) { | ||
grunt.log.warn('Destination ' + chalk.cyan(destFile) + ' not written because compiled files were empty.'); | ||
} else { | ||
var max = compiledMax.join(grunt.util.normalizelf(grunt.util.linefeed)); | ||
var min = compiledMin.join(options.cleancss ? '' : grunt.util.normalizelf(grunt.util.linefeed)); | ||
grunt.file.write(destFile, min); | ||
grunt.log.writeln('File ' + chalk.cyan(destFile) + ' created: ' + maxmin(max, min, options.report === 'gzip')); | ||
var allCss = compiled.join(options.compress ? '' : grunt.util.normalizelf(grunt.util.linefeed)); | ||
grunt.file.write(destFile, allCss); | ||
grunt.log.writeln('File ' + chalk.cyan(destFile) + ' created'); | ||
} | ||
@@ -101,3 +93,3 @@ nextFileObj(); | ||
var compileLess = function(srcFile, options, callback, sourceMapCallback) { | ||
var compileLess = function(srcFile, destFile, options) { | ||
options = _.assign({filename: srcFile}, options); | ||
@@ -114,2 +106,6 @@ options.paths = options.paths || [path.dirname(srcFile)]; | ||
if (options.sourceMap && !options.sourceMapFilename) { | ||
options.sourceMapFilename = destFile + '.map'; | ||
} | ||
if (typeof options.sourceMapBasepath === 'function') { | ||
@@ -123,10 +119,17 @@ try { | ||
var css; | ||
if (typeof(options.sourceMap) === "boolean" && options.sourceMap) { | ||
options.sourceMap = { | ||
sourceMapBasepath: options.sourceMapBasepath, | ||
sourceMapFilename: options.sourceMapFilename, | ||
sourceMapInputFilename: options.sourceMapInputFilename, | ||
sourceMapFullFilename: options.sourceMapFullFilename, | ||
sourceMapURL: options.sourceMapURL, | ||
sourceMapRootpath: options.sourceMapRootpath, | ||
outputSourceFiles: options.outputSourceFiles, | ||
sourceMapFileInline: options.sourceMapFileInline | ||
}; | ||
} | ||
var srcCode = grunt.file.read(srcFile); | ||
var parser = new less.Parser(_.pick(options, lessOptions.parse)); | ||
var additionalData = { | ||
banner: options.banner | ||
}; | ||
// Equivalent to --modify-vars option. | ||
@@ -141,34 +144,18 @@ // Properties under options.modifyVars are appended as less variables | ||
parser.parse(srcCode, function(parse_err, tree) { | ||
if (parse_err) { | ||
lessError(parse_err, srcFile); | ||
callback('',true); | ||
} | ||
// Load custom functions | ||
if (options.customFunctions) { | ||
Object.keys(options.customFunctions).forEach(function(name) { | ||
less.tree.functions[name.toLowerCase()] = function() { | ||
var args = [].slice.call(arguments); | ||
args.unshift(less); | ||
var res = options.customFunctions[name].apply(this, args); | ||
return typeof res === "object" ? res : new less.tree.Anonymous(res); | ||
}; | ||
// Load custom functions | ||
if (options.customFunctions) { | ||
Object.keys(options.customFunctions).forEach(function(name) { | ||
less.functions.functionRegistry.add(name.toLowerCase(), function() { | ||
var args = [].slice.call(arguments); | ||
args.unshift(less); | ||
var res = options.customFunctions[name].apply(this, args); | ||
return typeof res === 'object' ? res : new less.tree.Anonymous(res); | ||
}); | ||
} | ||
}); | ||
} | ||
var minifyOptions = _.pick(options, lessOptions.render); | ||
if (minifyOptions.sourceMapFilename) { | ||
minifyOptions.writeSourceMap = sourceMapCallback; | ||
} | ||
try { | ||
css = minify(tree, minifyOptions); | ||
callback(css, null); | ||
} catch (e) { | ||
lessError(e, srcFile); | ||
callback(css, true); | ||
} | ||
}, additionalData); | ||
return less.render(srcCode, options) | ||
.catch(function(err) { | ||
lessError(err, srcFile); | ||
}); | ||
}; | ||
@@ -202,12 +189,2 @@ | ||
}; | ||
var minify = function (tree, options) { | ||
var result = { | ||
min: tree.toCSS(options) | ||
}; | ||
if (!_.isEmpty(options)) { | ||
result.max = tree.toCSS(); | ||
} | ||
return result; | ||
}; | ||
}; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5
0
16589
154
233
+ Addedajv@4.11.8(transitive)
+ Addedasap@2.0.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@0.2.01.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedco@4.6.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddunder-proto@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addederrno@0.1.8(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.1.4(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.6(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhar-schema@1.0.5(transitive)
+ Addedhar-validator@4.2.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedimage-size@0.5.5(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-stable-stringify@1.1.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedless@2.7.3(transitive)
+ Addedmath-intrinsics@1.0.0(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedperformance-now@0.2.0(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedprr@1.0.1(transitive)
+ Addedpunycode@1.4.1(transitive)
+ Addedqs@6.4.1(transitive)
+ Addedrequest@2.81.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.3.4(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
- Removedmaxmin@^0.1.0
- Removedamdefine@1.0.1(transitive)
- Removedansi-styles@1.0.0(transitive)
- Removedasn1@0.1.11(transitive)
- Removedassert-plus@0.1.5(transitive)
- Removedasync@0.2.10(transitive)
- Removedaws-sign2@0.5.0(transitive)
- Removedboom@0.4.2(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedchalk@0.4.0(transitive)
- Removedclean-css@2.2.23(transitive)
- Removedcombined-stream@0.0.7(transitive)
- Removedcommander@2.2.0(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcryptiles@0.2.2(transitive)
- Removedctype@0.5.3(transitive)
- Removeddeep-equal@0.0.0(transitive)
- Removeddefined@0.0.0(transitive)
- Removeddelayed-stream@0.0.5(transitive)
- Removedforever-agent@0.5.2(transitive)
- Removedform-data@0.1.4(transitive)
- Removedgraceful-fs@3.0.12(transitive)
- Removedgzip-size@0.1.1(transitive)
- Removedhas-color@0.1.7(transitive)
- Removedhawk@1.1.1(transitive)
- Removedhoek@0.9.1(transitive)
- Removedhttp-signature@0.10.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedless@1.7.5(transitive)
- Removedmaxmin@0.1.0(transitive)
- Removedmime@1.2.11(transitive)
- Removedmime-types@1.0.2(transitive)
- Removednatives@1.1.6(transitive)
- Removednode-uuid@1.4.8(transitive)
- Removedoauth-sign@0.3.0(transitive)
- Removedpretty-bytes@0.1.2(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedqs@1.0.2(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrequest@2.40.0(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsntp@0.2.4(transitive)
- Removedsource-map@0.1.43(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@0.1.1(transitive)
- Removedtape@0.2.2(transitive)
- Removedtldts@6.1.67(transitive)
- Removedtldts-core@6.1.67(transitive)
- Removedtough-cookie@5.0.0(transitive)
- Removedtunnel-agent@0.4.3(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedzlib-browserify@0.0.3(transitive)
Updatedasync@^0.9.0
Updatedless@^2.1.0