grunt-contrib-less
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -54,1 +54,15 @@ # Options | ||
Accepts following values: `comments`, `mediaquery`, `all`. | ||
## report | ||
Choices: `false` `'min'` `'gzip'` | ||
Default: `false` | ||
Either do not report anything, report only minification result, or report minification and gzip results. This is useful to see exactly how well Less is performing, but using `'gzip'` can add 5-10x runtime task execution. | ||
Example ouput using `'gzip'`: | ||
``` | ||
Original: 198444 bytes. | ||
Minified: 101615 bytes. | ||
Gzipped: 20084 bytes. | ||
``` |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 Tyler Kellen, contributors | ||
* Copyright (c) 2013 Tyler Kellen, contributors | ||
* Licensed under the MIT license. | ||
@@ -40,3 +40,3 @@ */ | ||
'tmp/less.css': ['test/fixtures/style.less'], | ||
'tmp/concat.css': ['test/fixtures/style.less', 'test/fixtures/style2.less'] | ||
'tmp/concat.css': ['test/fixtures/style.less', 'test/fixtures/style2.less', 'test/fixtures/style3.less'] | ||
} | ||
@@ -89,2 +89,22 @@ }, | ||
files: { "tmp/nomatchedfiles.css" : 'test/nonexistent/*.less' } | ||
}, | ||
compressReport: { | ||
options: { | ||
paths: ['test/fixtures/include'], | ||
compress: true, | ||
report: 'min' | ||
}, | ||
files: { | ||
'tmp/compressReport.css': ['test/fixtures/style.less', 'test/fixtures/style2.less'] | ||
} | ||
}, | ||
yuicompressReport: { | ||
options: { | ||
paths: ['test/fixtures/include'], | ||
yuicompress: true, | ||
report: 'gzip' | ||
}, | ||
files: { | ||
'tmp/yuicompressReport.css': ['test/fixtures/style.less', 'test/fixtures/style2.less', 'test/fixtures/style3.less'] | ||
} | ||
} | ||
@@ -91,0 +111,0 @@ }, |
{ | ||
"name": "grunt-contrib-less", | ||
"description": "Compile LESS files to CSS.", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-less", | ||
@@ -31,7 +31,8 @@ "author": { | ||
"dependencies": { | ||
"less": "~1.4.0" | ||
"less": "~1.4.0", | ||
"grunt-lib-contrib": "~0.6.1" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "~0.2.0", | ||
"grunt-contrib-nodeunit": "~0.1.2", | ||
"grunt-contrib-nodeunit": "~0.2.0", | ||
"grunt-contrib-clean": "~0.4.0", | ||
@@ -38,0 +39,0 @@ "grunt-contrib-internal": "~0.4.2", |
@@ -83,2 +83,16 @@ # grunt-contrib-less [![Build Status](https://travis-ci.org/gruntjs/grunt-contrib-less.png?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-less) | ||
#### report | ||
Choices: `false` `'min'` `'gzip'` | ||
Default: `false` | ||
Either do not report anything, report only minification result, or report minification and gzip results. This is useful to see exactly how well Less is performing, but using `'gzip'` can add 5-10x runtime task execution. | ||
Example ouput using `'gzip'`: | ||
``` | ||
Original: 198444 bytes. | ||
Minified: 101615 bytes. | ||
Gzipped: 20084 bytes. | ||
``` | ||
### Usage Examples | ||
@@ -110,2 +124,3 @@ | ||
* 2013-07-06 v0.6.3 Add report option for minification and gzip results | ||
* 2013-07-03 v0.6.2 support syncImport | ||
@@ -128,2 +143,2 @@ * 2013-06-12 v0.6.1 Support ieCompat | ||
*This file was generated on Wed Jul 03 2013 14:55:40.* | ||
*This file was generated on Sat Jul 06 2013 20:52:15.* |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2012 Tyler Kellen, contributors | ||
* Copyright (c) 2013 Tyler Kellen, contributors | ||
* Licensed under the MIT license. | ||
@@ -14,2 +14,5 @@ */ | ||
// Internal lib. | ||
var contrib = require('grunt-lib-contrib').init(grunt); | ||
var path = require('path'); | ||
@@ -55,7 +58,10 @@ var less = require('less'); | ||
var compiled = []; | ||
var compiledMax = [], compiledMin = []; | ||
grunt.util.async.concatSeries(files, function(file, next) { | ||
compileLess(file, options, function(css, err) { | ||
if (!err) { | ||
compiled.push(css); | ||
if (css.max) { | ||
compiledMax.push(css.max); | ||
} | ||
compiledMin.push(css.min); | ||
next(); | ||
@@ -67,7 +73,13 @@ } else { | ||
}, function() { | ||
if (compiled.length < 1) { | ||
if (compiledMin.length < 1) { | ||
grunt.log.warn('Destination not written because compiled files were empty.'); | ||
} else { | ||
grunt.file.write(destFile, compiled.join(grunt.util.normalizelf(grunt.util.linefeed))); | ||
var min = compiledMin.join(options.yuicompress ? '' : grunt.util.normalizelf(grunt.util.linefeed)); | ||
grunt.file.write(destFile, min); | ||
grunt.log.writeln('File ' + destFile.cyan + ' created.'); | ||
// ...and report some size information. | ||
if (options.report) { | ||
contrib.minMaxInfo(min, compiledMax.join(grunt.util.normalizelf(grunt.util.linefeed)), options.report); | ||
} | ||
} | ||
@@ -96,3 +108,3 @@ nextFileObj(); | ||
try { | ||
css = tree.toCSS(grunt.util._.pick(options, lessOptions.render)); | ||
css = minify(tree, grunt.util._.pick(options, lessOptions.render)); | ||
callback(css, null); | ||
@@ -117,2 +129,12 @@ } catch (e) { | ||
}; | ||
var minify = function (tree, options) { | ||
var result = { | ||
min: tree.toCSS(options) | ||
}; | ||
if (!grunt.util._.isEmpty(options)) { | ||
result.max = tree.toCSS(); | ||
} | ||
return result; | ||
}; | ||
}; |
@@ -45,8 +45,14 @@ var grunt = require('grunt'); | ||
test.expect(1); | ||
var actual, expected; | ||
var actual = grunt.file.read('tmp/yuicompress.css'); | ||
var expected = grunt.file.read('test/expected/yuicompress.css'); | ||
test.expect(2); | ||
actual = grunt.file.read('tmp/yuicompress.css'); | ||
expected = grunt.file.read('test/expected/yuicompress.css'); | ||
test.equal(expected, actual, 'should yuicompress output when yuicompress option is true'); | ||
actual = grunt.file.read('tmp/yuicompressReport.css'); | ||
expected = grunt.file.read('test/expected/yuicompressReport.css'); | ||
test.equal(expected, actual, 'should yuicompress output when yuicompress option is true and concating is enable'); | ||
test.done(); | ||
@@ -56,13 +62,13 @@ }, | ||
'use strict'; | ||
var actual, expected; | ||
var actual, expected; | ||
test.expect(2); | ||
actual = grunt.file.read('tmp/ieCompatFalse.css'); | ||
expected = grunt.file.read('test/expected/ieCompatFalse.css'); | ||
actual = grunt.file.read('tmp/ieCompatFalse.css'); | ||
expected = grunt.file.read('test/expected/ieCompatFalse.css'); | ||
test.equal(expected, actual, 'should generate data-uris no matter the size when ieCompat option is true'); | ||
actual = grunt.file.read('tmp/ieCompatTrue.css'); | ||
expected = grunt.file.read('test/expected/ieCompatTrue.css'); | ||
actual = grunt.file.read('tmp/ieCompatTrue.css'); | ||
expected = grunt.file.read('test/expected/ieCompatTrue.css'); | ||
test.equal(expected, actual, 'should generate data-uris only when under the 32KB mark for Internet Explorer 8'); | ||
@@ -69,0 +75,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
174209
39
670
142
3
1
+ Addedgrunt-lib-contrib@~0.6.1
+ Addedgrunt-lib-contrib@0.6.1(transitive)
+ Addedzlib-browserify@0.0.1(transitive)