Merge branch 'master' of github.com:cloudhead/less.js
This commit is contained in:
commit
9b808fd305
@ -62,13 +62,12 @@ if (! input) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fs.stat(input, function (e, stats) {
|
||||
fs.readFile(input, 'utf-8', function (e, data) {
|
||||
if (e) {
|
||||
sys.puts("lessc: " + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
fs.open(input, process.O_RDONLY, stats.mode, function (e, fd) {
|
||||
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
|
||||
|
||||
new(less.Parser)({
|
||||
paths: [path.dirname(input)],
|
||||
optimization: options.optimization,
|
||||
@ -93,6 +92,3 @@ fs.stat(input, function (e, stats) {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -6,13 +6,12 @@ var isFileProtocol = (location.protocol === 'file:' ||
|
||||
location.protocol === 'chrome:' ||
|
||||
location.protocol === 'resource:');
|
||||
|
||||
less.env = less.env ||
|
||||
location.hostname == '127.0.0.1' ||
|
||||
less.env = less.env || (location.hostname == '127.0.0.1' ||
|
||||
location.hostname == '0.0.0.0' ||
|
||||
location.hostname == 'localhost' ||
|
||||
location.port.length > 0 ||
|
||||
isFileProtocol ? 'development'
|
||||
: 'production';
|
||||
: 'production');
|
||||
|
||||
// Load styles asynchronously (default: false)
|
||||
//
|
||||
|
@ -99,13 +99,7 @@ less.Parser.importer = function (file, paths, callback) {
|
||||
}
|
||||
|
||||
if (pathname) {
|
||||
fs.stat(pathname, function (e, stats) {
|
||||
if (e) sys.error(e);
|
||||
|
||||
fs.open(pathname, process.O_RDONLY, stats.mode, function (e, fd) {
|
||||
if (e) sys.error(e);
|
||||
|
||||
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
|
||||
fs.readFile(pathname, 'utf-8', function(e, data) {
|
||||
if (e) sys.error(e);
|
||||
|
||||
new(less.Parser)({
|
||||
@ -116,8 +110,6 @@ less.Parser.importer = function (file, paths, callback) {
|
||||
callback(root);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
sys.error("file '" + file + "' wasn't found.\n");
|
||||
process.exit(1);
|
||||
|
@ -24,7 +24,7 @@ fs.readdirSync('test/less').forEach(function (file) {
|
||||
toCSS('test/less/' + file, function (err, less) {
|
||||
var name = path.basename(file, '.less');
|
||||
|
||||
read(path.join('test/css', name) + '.css', function (e, css) {
|
||||
fs.readFile(path.join('test/css', name) + '.css', 'utf-8', function (e, css) {
|
||||
sys.print("- " + name + ": ")
|
||||
if (less === css) { sys.print(stylize('OK', 'green')) }
|
||||
else if (err) {
|
||||
@ -39,7 +39,7 @@ fs.readdirSync('test/less').forEach(function (file) {
|
||||
|
||||
function toCSS(path, callback) {
|
||||
var tree, css;
|
||||
read(path, function (e, str) {
|
||||
fs.readFile(path, 'utf-8', function (e, str) {
|
||||
if (e) { return callback(e) }
|
||||
|
||||
new(less.Parser)({
|
||||
@ -60,19 +60,6 @@ function toCSS(path, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function read(path, callback) {
|
||||
fs.stat(path, function (e, stats) {
|
||||
if (e) return callback(e);
|
||||
fs.open(path, process.O_RDONLY, stats.mode, function (e, fd) {
|
||||
if (e) return callback(e);
|
||||
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
|
||||
if (e) return callback(e);
|
||||
callback(null, data);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Stylize a string
|
||||
function stylize(str, style) {
|
||||
var styles = {
|
||||
|
Loading…
Reference in New Issue
Block a user