docpad-plugin-less
Advanced tools
Comparing version 2.1.1 to 2.1.2
## History | ||
- v2.1.2 December 5, 2012 | ||
- Better error reporting | ||
- We now parse less files with the `filename` option set to the file's `fullPath` (before we didn't send this at all) | ||
- Added `parseOptions` and `compileOptions` to configuration | ||
- v2.1.1 August 10, 2012 | ||
@@ -4,0 +9,0 @@ - Re-added markdown files to npm distribution as they are required for the npm website |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
@@ -20,2 +20,4 @@ var __hasProp = {}.hasOwnProperty, | ||
compress: true, | ||
parseOptions: null, | ||
compileOptions: null, | ||
environments: { | ||
@@ -29,3 +31,4 @@ development: { | ||
LessPlugin.prototype.render = function(opts, next) { | ||
var dirPath, file, inExtension, less, options, outExtension, path, srcPath, templateData; | ||
var config, dirPath, file, inExtension, key, less, outExtension, parseOptions, path, srcPath, templateData, value, _ref; | ||
config = this.config; | ||
inExtension = opts.inExtension, outExtension = opts.outExtension, templateData = opts.templateData, file = opts.file; | ||
@@ -37,13 +40,32 @@ if (inExtension === 'less' && (outExtension === 'css' || outExtension === null)) { | ||
dirPath = path.dirname(srcPath); | ||
options = { | ||
parseOptions = { | ||
paths: [dirPath], | ||
compress: this.config.compress | ||
filename: file.get('fullPath') | ||
}; | ||
return new less.Parser(options).parse(opts.content, function(err, tree) { | ||
if (config.parseOptions) { | ||
_ref = config.parseOptions; | ||
for (key in _ref) { | ||
if (!__hasProp.call(_ref, key)) continue; | ||
value = _ref[key]; | ||
parseOptions[key] = value; | ||
} | ||
} | ||
return new less.Parser(parseOptions).parse(opts.content, function(err, tree) { | ||
var compileOptions, _ref1; | ||
if (err) { | ||
err = new Error(less.formatError(err, parseOptions)); | ||
return next(err); | ||
} | ||
opts.content = tree.toCSS({ | ||
compress: options.compress | ||
}); | ||
compileOptions = { | ||
compress: config.compress | ||
}; | ||
if (config.compileOptions) { | ||
_ref1 = config.compileOptions; | ||
for (key in _ref1) { | ||
if (!__hasProp.call(_ref1, key)) continue; | ||
value = _ref1[key]; | ||
compileOptions[key] = value; | ||
} | ||
} | ||
opts.content = tree.toCSS(compileOptions); | ||
return next(); | ||
@@ -50,0 +72,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var __hasProp = {}.hasOwnProperty, |
{ | ||
"name": "docpad-plugin-less", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Adds support for the LESS CSS pre-processor to DocPad", | ||
"homepage": "https://github.com/bevry/docpad-extras", | ||
"homepage": "http://docpad.org/plugin/less", | ||
"keywords": [ | ||
@@ -10,2 +10,3 @@ "docpad", | ||
"less", | ||
"less.js", | ||
"lesscss", | ||
@@ -38,3 +39,3 @@ "css", | ||
"devDependencies": { | ||
"coffee-script": "1.3.x" | ||
"coffee-script": "1.4.x" | ||
}, | ||
@@ -41,0 +42,0 @@ "main": "./out/less.plugin.js", |
# LessCSS Plugin for DocPad | ||
Adds support for the [LESS](http://lesscss.org/) CSS pre-processor to [DocPad](https://github.com/bevry/docpad) | ||
Adds support for the [LESS](http://lesscss.org/) CSS pre-processor to [DocPad](https://docpad.org) | ||
@@ -4,0 +4,0 @@ Convention: `.css.less` |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
5789
86
0