bin/ init

This commit is contained in:
cloudhead 2010-02-26 18:18:11 -05:00
parent 3903ed0864
commit d3852cf463

26
bin/lessc Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env node
var path = require('path'),
fs = require('fs'),
sys = require('sys');
require.paths.unshift(__dirname, path.join(__dirname, '..'));
var less = require('lib/less/adapters/server');
var input = path.join(process.cwd(), process.argv[2]),
output = path.join(process.cwd(), process.argv[3] ||
input.replace(/\.le?ss$/, '.css'));
var css, fd, tree;
fs.stat(input, function (e, stats) {
fs.open(input, process.O_RDONLY, stats.mode, function (e, fd) {
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
tree = less.parser.parse(data);
css = tree.toCSS([], {frames: []});
fd = fs.openSync(output, "w");
fs.writeSync(fd, css, 0, "utf8");
});
});
});