mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
16
Gruntfile.js
16
Gruntfile.js
@@ -187,13 +187,17 @@ module.exports = function (grunt) {
|
||||
command: 'node benchmark/index.js'
|
||||
},
|
||||
plugin: {
|
||||
command: 'node bin/lessc --clean-css="--s1 --advanced" test/less/lazy-eval.less tmp/lazy-eval.css'
|
||||
command: [
|
||||
'node bin/lessc --clean-css="--s1 --advanced" test/less/lazy-eval.less tmp/lazy-eval.css',
|
||||
'cd lib',
|
||||
'node ../bin/lessc --clean-css="--s1 --advanced" ../test/less/lazy-eval.less ../tmp/lazy-eval.css'
|
||||
].join(' && ')
|
||||
},
|
||||
"sourcemap-test": {
|
||||
command: [
|
||||
'node bin/lessc --source-map=test/sourcemaps/maps/import-map.map test/less/import.less test/sourcemaps/import.css',
|
||||
'node bin/lessc --source-map test/less/sourcemaps/basic.less test/sourcemaps/basic.css'
|
||||
].join('&&')
|
||||
].join(' && ')
|
||||
}
|
||||
},
|
||||
|
||||
@@ -508,11 +512,6 @@ module.exports = function (grunt) {
|
||||
'sauce-after-setup'
|
||||
]);
|
||||
|
||||
// var sauceTests = [];
|
||||
// browserTests.map(function(testName) {
|
||||
// sauceTests.push('saucelabs-jasmine:' + testName);
|
||||
// });
|
||||
|
||||
grunt.registerTask('sauce-after-setup', [
|
||||
'saucelabs-jasmine:all',
|
||||
'clean:sauce_log'
|
||||
@@ -537,6 +536,9 @@ module.exports = function (grunt) {
|
||||
// Run all tests
|
||||
grunt.registerTask('test', testTasks);
|
||||
|
||||
// Run shell plugin test
|
||||
grunt.registerTask('shell-plugin', ['shell:plugin']);
|
||||
|
||||
// Run all tests
|
||||
grunt.registerTask('quicktest', testTasks.slice(0, -1));
|
||||
|
||||
|
||||
9
dist/less.js
vendored
9
dist/less.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Less - Leaner CSS v3.0.1
|
||||
* Less - Leaner CSS v3.0.3
|
||||
* http://lesscss.org
|
||||
*
|
||||
* Copyright (c) 2009-2018, Alexis Sellier <self@cloudhead.net>
|
||||
@@ -2728,7 +2728,10 @@ module.exports = function(environment) {
|
||||
callback(null, {rules:[]}, false, null);
|
||||
}
|
||||
else {
|
||||
if (!importManager.files[fullPath]) {
|
||||
// Inline imports aren't cached here.
|
||||
// If we start to cache them, please make sure they won't conflict with non-inline imports of the
|
||||
// same name as they used to do before this comment and the condition below have been added.
|
||||
if (!importManager.files[fullPath] && !importOptions.inline) {
|
||||
importManager.files[fullPath] = { root: root, options: importOptions };
|
||||
}
|
||||
if (e && !importManager.error) { importManager.error = e; }
|
||||
@@ -2843,7 +2846,7 @@ module.exports = function(environment, fileManagers) {
|
||||
var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
|
||||
|
||||
var initial = {
|
||||
version: [3, 0, 1],
|
||||
version: [3, 0, 3],
|
||||
data: require('./data'),
|
||||
tree: require('./tree'),
|
||||
Environment: (Environment = require("./environment/environment")),
|
||||
|
||||
6
dist/less.min.js
vendored
6
dist/less.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -24,7 +24,9 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
|
||||
self = this,
|
||||
prefix = filename.slice(0, 1),
|
||||
explicit = prefix === "." || prefix === "/",
|
||||
result = null;
|
||||
result = null,
|
||||
isNodeModule = false,
|
||||
npmPrefix = 'npm://';
|
||||
|
||||
options = options || {};
|
||||
|
||||
@@ -32,9 +34,6 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
|
||||
|
||||
if (options.paths) { paths.push.apply(paths, options.paths); }
|
||||
|
||||
// Search node_modules
|
||||
if (!explicit) { paths.push.apply(paths, this.modulePaths); }
|
||||
|
||||
if (!isAbsoluteFilename && paths.indexOf('.') === -1) { paths.push('.'); }
|
||||
|
||||
var prefixes = options.prefixes || [''];
|
||||
@@ -70,20 +69,44 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
|
||||
if (i < paths.length) {
|
||||
(function tryPrefix(j) {
|
||||
if (j < prefixes.length) {
|
||||
isNodeModule = false;
|
||||
fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename;
|
||||
|
||||
if (paths[i]) {
|
||||
fullFilename = path.join(paths[i], fullFilename);
|
||||
}
|
||||
|
||||
if (paths[i].indexOf('node_modules') > -1) {
|
||||
if (!explicit && paths[i] === '.') {
|
||||
try {
|
||||
fullFilename = require.resolve(fullFilename);
|
||||
isNodeModule = true;
|
||||
}
|
||||
catch (e) {}
|
||||
catch (e) {
|
||||
filenamesTried.push(npmPrefix + fullFilename);
|
||||
tryWithExtension();
|
||||
}
|
||||
}
|
||||
else {
|
||||
tryWithExtension();
|
||||
}
|
||||
|
||||
fullFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename;
|
||||
function tryWithExtension() {
|
||||
var extFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename;
|
||||
|
||||
if (extFilename !== fullFilename && !explicit && paths[i] === '.') {
|
||||
try {
|
||||
fullFilename = require.resolve(extFilename);
|
||||
isNodeModule = true;
|
||||
}
|
||||
catch (e) {
|
||||
filenamesTried.push(npmPrefix + extFilename);
|
||||
fullFilename = extFilename;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fullFilename = extFilename;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.contents[fullFilename]) {
|
||||
fulfill({ contents: self.contents[fullFilename], filename: fullFilename});
|
||||
@@ -100,14 +123,14 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
|
||||
fulfill({ contents: data, filename: fullFilename});
|
||||
}
|
||||
catch (e) {
|
||||
filenamesTried.push(fullFilename);
|
||||
filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);
|
||||
return tryPrefix(j + 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
readFileArgs.push(function(e, data) {
|
||||
if (e) {
|
||||
filenamesTried.push(fullFilename);
|
||||
filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);
|
||||
return tryPrefix(j + 1);
|
||||
}
|
||||
self.contents[fullFilename] = data;
|
||||
|
||||
@@ -16,9 +16,6 @@ less.UrlFileManager = UrlFileManager;
|
||||
|
||||
// Set up options
|
||||
less.options = require('../less/default-options')();
|
||||
less.options.paths = [
|
||||
path.join(process.cwd(), "node_modules")
|
||||
];
|
||||
|
||||
// provide image-size functionality
|
||||
require('./image-size')(less.environment);
|
||||
|
||||
@@ -2,7 +2,7 @@ module.exports = function(environment, fileManagers) {
|
||||
var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
|
||||
|
||||
var initial = {
|
||||
version: [3, 0, 1],
|
||||
version: [3, 0, 3],
|
||||
data: require('./data'),
|
||||
tree: require('./tree'),
|
||||
Environment: (Environment = require("./environment/environment")),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "less",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"description": "Leaner CSS",
|
||||
"homepage": "http://lesscss.org",
|
||||
"author": {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FileError: '{pathhref}file-does-not-exist.less' wasn't found{404status}{node}. Tried - {path}file-does-not-exist.less,{pathrel}file-does-not-exist.less,{nodepath}file-does-not-exist.less,file-does-not-exist.less{/node} in {path}import-missing.less on line 6, column 1:
|
||||
FileError: '{pathhref}file-does-not-exist.less' wasn't found{404status}{node}. Tried - {path}file-does-not-exist.less,{pathrel}file-does-not-exist.less,npm://file-does-not-exist.less,file-does-not-exist.less{/node} in {path}import-missing.less on line 6, column 1:
|
||||
5
|
||||
6 @import "file-does-not-exist.less";
|
||||
|
||||
Reference in New Issue
Block a user