bin/ init
This commit is contained in:
parent
3903ed0864
commit
d3852cf463
26
bin/lessc
Executable file
26
bin/lessc
Executable 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");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user