Skip to content

Commit

Permalink
added in less support
Browse files Browse the repository at this point in the history
  • Loading branch information
tbranyen committed Sep 26, 2012
1 parent a9dbe42 commit d4af4c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tasks/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ module.exports = function(grunt) {
});
});

// Process LESS stylesheets.
site.get(/.less$/, function(req, res) {
var url = req.url.split("assets/css/")[1];
var file = path.join("assets/css", url);

fs.readFile(file, function(err, contents) {
grunt.helper("less", contents.toString(), {
paths: ["assets/css/"]
}, function(css) {
res.header("Content-type", "text/css");
res.send(css);
});
});
});

// Map static folders.
Object.keys(options.folders).sort().reverse().forEach(function(key) {
site.get(root + key + "/*", function(req, res, next) {
Expand Down
6 changes: 6 additions & 0 deletions tasks/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ module.exports = function(grunt) {
return grunt.helper("stylus", contents, options, function(css) {
output += css;
});

// Parse LESS files.
} else if (path.extname(filepath).slice(1) === "less") {
return grunt.helper("less", contents, options, function(css) {
output += css;
});
}

// Add vanilla CSS files.
Expand Down

0 comments on commit d4af4c7

Please sign in to comment.