Skip to content

Commit

Permalink
passing tests for less 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sintaxi committed Apr 18, 2015
1 parent 4ad2e05 commit 1910206
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
27 changes: 7 additions & 20 deletions lib/stylesheet/processors/less.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
var less = require("less")
var TerraformError = require("../../error").TerraformError



exports.compile = function(filePath, dirs, fileContents, callback){

var formatError = function(e){
Expand All @@ -17,24 +15,13 @@ exports.compile = function(filePath, dirs, fileContents, callback){
})
}

var parser = new(less.Parser)({
paths: dirs, // Specify search paths for @import directives
filename: filePath // Specify a filename, for better error messages
})

parser.parse(fileContents.toString(), function (e, tree) {
if(e) return callback(formatError(e))

try{
var error = null
var css = tree.toCSS({ compress: true })
}catch(e){
var error = formatError(e)
var css = null
}finally{
callback(error, css)
}

less.render(fileContents.toString(), {
paths: dirs, // Specify search paths for @import directives
filename: filePath, // Specify a filename, for better error messages
compress: false // Minify CSS output
}, function(e, css){
if (e) return callback(formatError(e))
return callback(null, css.css)
})
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"ejs": "1.0.0",
"node-sass": "3.0.0-beta.5",
"marked": "0.3.3",
"less": "1.7.5",
"less": "2.5.0",
"stylus": "0.47.3",
"minify": "git://github.com/kennethormandy/minify#v0.3.0",
"autoprefixer": "5.1.0"
Expand Down
2 changes: 0 additions & 2 deletions test/stylesheets.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ describe("stylesheets", function(){
})
})



})

describe(".styl", function(){
Expand Down

0 comments on commit 1910206

Please sign in to comment.