docpad-plugin-less
Advanced tools
Comparing version 2.1.2 to 2.1.3
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var __hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
var __hasProp = {}.hasOwnProperty, | ||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
module.exports = function(BasePlugin) { | ||
var LessPlugin; | ||
return LessPlugin = (function(_super) { | ||
module.exports = function(BasePlugin) { | ||
var LessPlugin; | ||
return LessPlugin = (function(_super) { | ||
__extends(LessPlugin, _super); | ||
__extends(LessPlugin, _super); | ||
function LessPlugin() { | ||
return LessPlugin.__super__.constructor.apply(this, arguments); | ||
function LessPlugin() { | ||
return LessPlugin.__super__.constructor.apply(this, arguments); | ||
} | ||
LessPlugin.prototype.name = 'less'; | ||
LessPlugin.prototype.config = { | ||
compress: true, | ||
parseOptions: null, | ||
compileOptions: null, | ||
environments: { | ||
development: { | ||
compress: false | ||
} | ||
} | ||
}; | ||
LessPlugin.prototype.name = 'less'; | ||
LessPlugin.prototype.config = { | ||
compress: true, | ||
parseOptions: null, | ||
compileOptions: null, | ||
environments: { | ||
development: { | ||
compress: false | ||
LessPlugin.prototype.render = function(opts, next) { | ||
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; | ||
if (inExtension === 'less' && (outExtension === 'css' || outExtension === null)) { | ||
path = require('path'); | ||
less = require('less'); | ||
srcPath = file.get('fullPath'); | ||
dirPath = path.dirname(srcPath); | ||
parseOptions = { | ||
paths: [dirPath], | ||
filename: file.get('fullPath') | ||
}; | ||
if (config.parseOptions) { | ||
_ref = config.parseOptions; | ||
for (key in _ref) { | ||
if (!__hasProp.call(_ref, key)) continue; | ||
value = _ref[key]; | ||
parseOptions[key] = value; | ||
} | ||
} | ||
}; | ||
LessPlugin.prototype.render = function(opts, next) { | ||
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; | ||
if (inExtension === 'less' && (outExtension === 'css' || outExtension === null)) { | ||
path = require('path'); | ||
less = require('less'); | ||
srcPath = file.get('fullPath'); | ||
dirPath = path.dirname(srcPath); | ||
parseOptions = { | ||
paths: [dirPath], | ||
filename: file.get('fullPath') | ||
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); | ||
} | ||
compileOptions = { | ||
compress: config.compress | ||
}; | ||
if (config.parseOptions) { | ||
_ref = config.parseOptions; | ||
for (key in _ref) { | ||
if (!__hasProp.call(_ref, key)) continue; | ||
value = _ref[key]; | ||
parseOptions[key] = value; | ||
if (config.compileOptions) { | ||
_ref1 = config.compileOptions; | ||
for (key in _ref1) { | ||
if (!__hasProp.call(_ref1, key)) continue; | ||
value = _ref1[key]; | ||
compileOptions[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); | ||
} | ||
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(); | ||
}); | ||
} else { | ||
opts.content = tree.toCSS(compileOptions); | ||
return next(); | ||
} | ||
}; | ||
}); | ||
} else { | ||
return next(); | ||
} | ||
}; | ||
return LessPlugin; | ||
return LessPlugin; | ||
})(BasePlugin); | ||
}; | ||
}).call(this); | ||
})(BasePlugin); | ||
}; |
{ | ||
"name": "docpad-plugin-less", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Adds support for the LESS CSS pre-processor to DocPad", | ||
@@ -18,6 +18,6 @@ "homepage": "http://docpad.org/plugin/less", | ||
"maintainers": [ | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)" | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)" | ||
], | ||
"contributors": [ | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)" | ||
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)" | ||
], | ||
@@ -32,15 +32,15 @@ "bugs": { | ||
"engines" : { | ||
"node": ">=0.4.0", | ||
"node": ">=0.4", | ||
"docpad": "6.x" | ||
}, | ||
"dependencies": { | ||
"less": "1.3.x" | ||
"less": "~1.3.0" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "1.4.x" | ||
"coffee-script": "~1.4.0" | ||
}, | ||
"main": "./out/less.plugin.js", | ||
"scripts": { | ||
"test": "node ./test/less.test.js" | ||
"test": "node ./out/less.test.js" | ||
} | ||
} |
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
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
4364
4
69
Updatedless@~1.3.0