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

grunt-contrib-less

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-less - npm Package Compare versions

Comparing version 0.12.0 to 1.0.0

26

package.json
{
"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"
}

@@ -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;
};
};
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