mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
eslint spaced-comment and corresponding changes
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
"all"
|
||||
],
|
||||
"space-infix-ops": 2,
|
||||
"spaced-comment": 1,
|
||||
"space-before-blocks": [
|
||||
2,
|
||||
"always"
|
||||
|
||||
2
lib/less-browser/bootstrap.js
vendored
2
lib/less-browser/bootstrap.js
vendored
@@ -3,7 +3,7 @@
|
||||
* used in the browser distributed version of less
|
||||
* to kick-start less using the browser api
|
||||
*/
|
||||
/*global window, document */
|
||||
/* global window, document */
|
||||
|
||||
// TODO - consider switching this out for a recommendation for this polyfill?
|
||||
// <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = function(window, options, logger) {
|
||||
cache.setItem(path + ':vars', JSON.stringify(modifyVars));
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO - could do with adding more robust error handling
|
||||
// TODO - could do with adding more robust error handling
|
||||
logger.error('failed to save "' + path + '" to local storage for caching.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ module.exports = function(window, less, options) {
|
||||
}
|
||||
|
||||
function removeErrorConsole(path) {
|
||||
//no action
|
||||
// no action
|
||||
}
|
||||
|
||||
function removeError(path) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*global window, XMLHttpRequest */
|
||||
/* global window, XMLHttpRequest */
|
||||
|
||||
module.exports = function(options, logger) {
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = function(options, logger) {
|
||||
|
||||
var fileCache = {};
|
||||
|
||||
//TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
|
||||
// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
|
||||
var FileManager = function() {
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = function(window, options) {
|
||||
var cache = less.cache = options.cache || require("./cache")(window, options, less.logger);
|
||||
require('./image-size')(less.environment);
|
||||
|
||||
//Setup user functions - Deprecate?
|
||||
// Setup user functions - Deprecate?
|
||||
if (options.functions) {
|
||||
less.functions.functionRegistry.addMultiple(options.functions);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ module.exports = function(window, options) {
|
||||
var lessText = style.innerHTML || '';
|
||||
instanceOptions.filename = document.location.href.replace(/#.*$/, '');
|
||||
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
// use closure to store current style
|
||||
less.render(lessText, instanceOptions,
|
||||
bind(function(style, e, result) {
|
||||
@@ -116,7 +116,7 @@ module.exports = function(window, options) {
|
||||
|
||||
}
|
||||
|
||||
//TODO add tests around how this behaves when reloading
|
||||
// TODO add tests around how this behaves when reloading
|
||||
errors.remove(path);
|
||||
|
||||
instanceOptions.rootFileInfo = newFileInfo;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*global window */
|
||||
/* global window */
|
||||
|
||||
var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// helper functions for lessc
|
||||
var lessc_helper = {
|
||||
|
||||
//Stylize a string
|
||||
// Stylize a string
|
||||
stylize : function(str, style) {
|
||||
var styles = {
|
||||
'reset' : [0, 0],
|
||||
@@ -19,7 +19,7 @@ var lessc_helper = {
|
||||
'\x1b[' + styles[style][1] + 'm';
|
||||
},
|
||||
|
||||
//Print command line options
|
||||
// Print command line options
|
||||
printUsage: function() {
|
||||
console.log("usage: lessc [option option=parameter ...] <source> [destination]");
|
||||
console.log("");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* jshint rhino:true, unused: false */
|
||||
/* jscs:disable validateIndentation */
|
||||
/*global name:true, less, loadStyleSheet, os */
|
||||
/* global name:true, less, loadStyleSheet, os */
|
||||
|
||||
function formatError(ctx, options) {
|
||||
options = options || {};
|
||||
@@ -9,7 +8,7 @@ function formatError(ctx, options) {
|
||||
var extract = ctx.extract;
|
||||
var error = [];
|
||||
|
||||
// var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; };
|
||||
// var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; };
|
||||
var stylize = function (str) { return str; };
|
||||
|
||||
// only output a stack if it isn't a less error
|
||||
@@ -211,8 +210,8 @@ function writeFile(filename, content) {
|
||||
break;
|
||||
case 'h':
|
||||
case 'help':
|
||||
//TODO
|
||||
// require('../lib/less/lessc_helper').printUsage();
|
||||
// TODO
|
||||
// require('../lib/less/lessc_helper').printUsage();
|
||||
continueProcessing = false;
|
||||
break;
|
||||
case 'x':
|
||||
@@ -255,7 +254,7 @@ function writeFile(filename, content) {
|
||||
.split(os.type().match(/Windows/) ? /:(?!\\)|;/ : ':')
|
||||
.map(function(p) {
|
||||
if (p) {
|
||||
// return path.resolve(process.cwd(), p);
|
||||
// return path.resolve(process.cwd(), p);
|
||||
return p;
|
||||
}
|
||||
});
|
||||
@@ -336,20 +335,20 @@ function writeFile(filename, content) {
|
||||
|
||||
var name = args[0];
|
||||
if (name && name != '-') {
|
||||
// name = path.resolve(process.cwd(), name);
|
||||
// name = path.resolve(process.cwd(), name);
|
||||
}
|
||||
var output = args[1];
|
||||
var outputbase = args[1];
|
||||
if (output) {
|
||||
options.sourceMapOutputFilename = output;
|
||||
// output = path.resolve(process.cwd(), output);
|
||||
// output = path.resolve(process.cwd(), output);
|
||||
if (warningMessages) {
|
||||
console.log(warningMessages);
|
||||
}
|
||||
}
|
||||
|
||||
// options.sourceMapBasepath = process.cwd();
|
||||
// options.sourceMapBasepath = '';
|
||||
// options.sourceMapBasepath = process.cwd();
|
||||
// options.sourceMapBasepath = '';
|
||||
|
||||
if (options.sourceMap === true) {
|
||||
console.log("output: " + output);
|
||||
@@ -367,24 +366,25 @@ function writeFile(filename, content) {
|
||||
console.log("lessc: no inout files");
|
||||
console.log("");
|
||||
// TODO
|
||||
// require('../lib/less/lessc_helper').printUsage();
|
||||
// require('../lib/less/lessc_helper').printUsage();
|
||||
currentErrorcode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// var ensureDirectory = function (filepath) {
|
||||
// var dir = path.dirname(filepath),
|
||||
// cmd,
|
||||
// existsSync = fs.existsSync || path.existsSync;
|
||||
// if (!existsSync(dir)) {
|
||||
// if (mkdirp === undefined) {
|
||||
// try {mkdirp = require('mkdirp');}
|
||||
// catch(e) { mkdirp = null; }
|
||||
// }
|
||||
// cmd = mkdirp && mkdirp.sync || fs.mkdirSync;
|
||||
// cmd(dir);
|
||||
// }
|
||||
// };
|
||||
/*
|
||||
var ensureDirectory = function (filepath) {
|
||||
var dir = path.dirname(filepath),
|
||||
cmd,
|
||||
existsSync = fs.existsSync || path.existsSync;
|
||||
if (!existsSync(dir)) {
|
||||
if (mkdirp === undefined) {
|
||||
try {mkdirp = require('mkdirp');}
|
||||
catch(e) { mkdirp = null; }
|
||||
}
|
||||
cmd = mkdirp && mkdirp.sync || fs.mkdirSync;
|
||||
cmd(dir);
|
||||
}
|
||||
}; */
|
||||
|
||||
if (options.depends) {
|
||||
if (!outputbase) {
|
||||
|
||||
@@ -40,17 +40,17 @@ contexts.Parse = function(options) {
|
||||
};
|
||||
|
||||
var evalCopyProperties = [
|
||||
'paths', // additional include paths
|
||||
'compress', // whether to compress
|
||||
'ieCompat', // whether to enforce IE compatibility (IE8 data-uri)
|
||||
'strictMath', // whether math has to be within parenthesis
|
||||
'strictUnits', // whether units need to evaluate correctly
|
||||
'sourceMap', // whether to output a source map
|
||||
'importMultiple', // whether we are currently importing multiple copies
|
||||
'urlArgs', // whether to add args into url tokens
|
||||
'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false
|
||||
'pluginManager', // Used as the plugin manager for the session
|
||||
'importantScope' // used to bubble up !important statements
|
||||
'paths', // additional include paths
|
||||
'compress', // whether to compress
|
||||
'ieCompat', // whether to enforce IE compatibility (IE8 data-uri)
|
||||
'strictMath', // whether math has to be within parenthesis
|
||||
'strictUnits', // whether units need to evaluate correctly
|
||||
'sourceMap', // whether to output a source map
|
||||
'importMultiple', // whether we are currently importing multiple copies
|
||||
'urlArgs', // whether to add args into url tokens
|
||||
'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false
|
||||
'pluginManager', // Used as the plugin manager for the session
|
||||
'importantScope' // used to bubble up !important statements
|
||||
];
|
||||
|
||||
contexts.Eval = function(options, frames) {
|
||||
@@ -108,4 +108,4 @@ contexts.Eval.prototype.normalizePath = function( path ) {
|
||||
return path.join("/");
|
||||
};
|
||||
|
||||
//todo - do the same for the toCSS ?
|
||||
// todo - do the same for the toCSS ?
|
||||
|
||||
@@ -278,7 +278,7 @@ colorFunctions = {
|
||||
if (typeof dark === 'undefined') {
|
||||
dark = colorFunctions.rgba(0, 0, 0, 1.0);
|
||||
}
|
||||
//Figure out which is actually light and dark!
|
||||
// Figure out which is actually light and dark:
|
||||
if (dark.luma() > light.luma()) {
|
||||
var t = light;
|
||||
light = dark;
|
||||
|
||||
@@ -7,7 +7,7 @@ function makeRegistry( base ) {
|
||||
name = name.toLowerCase();
|
||||
|
||||
if (this._data.hasOwnProperty(name)) {
|
||||
//TODO warn
|
||||
// TODO warn
|
||||
}
|
||||
this._data[name] = func;
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ module.exports = function(environment) {
|
||||
functionCaller: require("./function-caller")
|
||||
};
|
||||
|
||||
//register functions
|
||||
// register functions
|
||||
require("./default");
|
||||
require("./color");
|
||||
require("./color-blending");
|
||||
|
||||
@@ -19,12 +19,12 @@ functionRegistry.addMultiple({
|
||||
result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement);
|
||||
return new Quoted(string.quote || '', result, string.escaped);
|
||||
},
|
||||
'%': function (string /* arg, arg, ...*/) {
|
||||
'%': function (string /* arg, arg, ... */) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
result = string.value;
|
||||
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
result = result.replace(/%[sda]/i, function(token) {
|
||||
var value = ((args[i].type === "Quoted") &&
|
||||
token.match(/s/i)) ? args[i].value : args[i].toCSS();
|
||||
|
||||
@@ -37,7 +37,7 @@ module.exports = function(environment, fileManagers) {
|
||||
};
|
||||
var t, api = Object.create(initial);
|
||||
for (var n in initial.tree) {
|
||||
/*eslint guard-for-in: 0 */
|
||||
/* eslint guard-for-in: 0 */
|
||||
t = initial.tree[n];
|
||||
if (typeof t === "function") {
|
||||
api[n] = ctor(t);
|
||||
@@ -45,7 +45,7 @@ module.exports = function(environment, fileManagers) {
|
||||
else {
|
||||
api[n] = Object.create(null);
|
||||
for (var o in t) {
|
||||
/*eslint guard-for-in: 0 */
|
||||
/* eslint guard-for-in: 0 */
|
||||
api[n][o] = ctor(t[o]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
var chunker = require('./chunker');
|
||||
|
||||
module.exports = function() {
|
||||
var input, // LeSS input string
|
||||
var input, // Less input string
|
||||
j, // current chunk
|
||||
saveStack = [], // holds state for backtracking
|
||||
furthest, // furthest index the parser has gone to
|
||||
furthestPossibleErrorMessage,// if this is furthest we got to, this is the probably cause
|
||||
furthestPossibleErrorMessage, // if this is furthest we got to, this is the probably cause
|
||||
chunks, // chunkified input
|
||||
current, // current chunk
|
||||
currentPos, // index of current chunk, in `input`
|
||||
@@ -209,7 +209,7 @@ module.exports = function() {
|
||||
|
||||
parserInput.peekNotNumeric = function() {
|
||||
var c = input.charCodeAt(parserInput.i);
|
||||
//Is the first char of the dimension 0-9, '.', '+' or '-'
|
||||
// Is the first char of the dimension 0-9, '.', '+' or '-'
|
||||
return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ var LessError = require('../less-error'),
|
||||
// Token matching is done with the `$` function, which either takes
|
||||
// a terminal string or regexp, or a non-terminal function to call.
|
||||
// It also takes care of moving all the indices forwards.
|
||||
//`
|
||||
//
|
||||
|
||||
var Parser = function Parser(context, imports, fileInfo) {
|
||||
var parsers,
|
||||
parserInput = getParserInput();
|
||||
|
||||
@@ -47,7 +47,7 @@ module.exports = function (environment) {
|
||||
|
||||
SourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) {
|
||||
|
||||
//ignore adding empty strings
|
||||
// ignore adding empty strings
|
||||
if (!chunk) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ AtRule.prototype.genCSS = function (context, output) {
|
||||
AtRule.prototype.eval = function (context) {
|
||||
var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules;
|
||||
|
||||
//media stored inside other atrule should not bubble over it
|
||||
//backpup media bubbling information
|
||||
// media stored inside other atrule should not bubble over it
|
||||
// backpup media bubbling information
|
||||
mediaPathBackup = context.mediaPath;
|
||||
mediaBlocksBackup = context.mediaBlocks;
|
||||
//deleted media bubbling information
|
||||
// deleted media bubbling information
|
||||
context.mediaPath = [];
|
||||
context.mediaBlocks = [];
|
||||
|
||||
@@ -77,7 +77,7 @@ AtRule.prototype.eval = function (context) {
|
||||
rules = [rules[0].eval(context)];
|
||||
rules[0].root = true;
|
||||
}
|
||||
//restore media bubbling information
|
||||
// restore media bubbling information
|
||||
context.mediaPath = mediaPathBackup;
|
||||
context.mediaBlocks = mediaBlocksBackup;
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ Color.prototype.toHSL = function () {
|
||||
}
|
||||
return { h: h * 360, s: s, l: l, a: a };
|
||||
};
|
||||
//Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
|
||||
// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
|
||||
Color.prototype.toHSV = function () {
|
||||
var r = this.rgb[0] / 255,
|
||||
g = this.rgb[1] / 255,
|
||||
|
||||
@@ -61,7 +61,7 @@ Dimension.prototype.genCSS = function (context, output) {
|
||||
// we default to the first Dimension's unit,
|
||||
// so `1px + 2` will yield `3px`.
|
||||
Dimension.prototype.operate = function (context, op, other) {
|
||||
/*jshint noempty:false */
|
||||
/* jshint noempty:false */
|
||||
var value = this._operate(context, op, this.value, other.value),
|
||||
unit = this.unit.clone();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ Extend.prototype.eval = function (context) {
|
||||
Extend.prototype.clone = function (context) {
|
||||
return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
|
||||
};
|
||||
//it concatenates (joins) all selectors in selector array
|
||||
// it concatenates (joins) all selectors in selector array
|
||||
Extend.prototype.findSelfSelectors = function (selectors) {
|
||||
var selfElements = [],
|
||||
i,
|
||||
|
||||
@@ -31,7 +31,7 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) {
|
||||
var variables = context.frames[0].variables();
|
||||
for (var k in variables) {
|
||||
if (variables.hasOwnProperty(k)) {
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
evalContext[k.slice(1)] = {
|
||||
value: variables[k].value,
|
||||
toJS: function () {
|
||||
|
||||
@@ -43,7 +43,7 @@ Definition.prototype.accept = function (visitor) {
|
||||
}
|
||||
};
|
||||
Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) {
|
||||
/*jshint boss:true */
|
||||
/* jshint boss:true */
|
||||
var frame = new Ruleset(null, null),
|
||||
varargs, arg,
|
||||
params = utils.copyArray(this.params),
|
||||
@@ -156,7 +156,7 @@ Definition.prototype.evalCall = function (context, args, important) {
|
||||
Definition.prototype.matchCondition = function (args, context) {
|
||||
if (this.condition && !this.condition.eval(
|
||||
new contexts.Eval(context,
|
||||
[this.evalParams(context, /* the parameter variables*/
|
||||
[this.evalParams(context, /* the parameter variables */
|
||||
new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
|
||||
.concat(this.frames || []) // the parent namespace/mixin frames
|
||||
.concat(context.frames)))) { // the current environment frames
|
||||
|
||||
@@ -63,8 +63,8 @@ Node.prototype._operate = function (context, op, a, b) {
|
||||
};
|
||||
Node.prototype.fround = function(context, value) {
|
||||
var precision = context && context.numPrecision;
|
||||
//add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999....) are properly rounded...
|
||||
return (precision == null) ? value : Number((value + 2e-16).toFixed(precision));
|
||||
// add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded:
|
||||
return (precision) ? Number((value + 2e-16).toFixed(precision)) : value;
|
||||
};
|
||||
Node.compare = function (a, b) {
|
||||
/* returns:
|
||||
@@ -124,13 +124,13 @@ Node.prototype.removeVisibilityBlock = function () {
|
||||
}
|
||||
this.visibilityBlocks = this.visibilityBlocks - 1;
|
||||
};
|
||||
//Turns on node visibility - if called node will be shown in output regardless
|
||||
//of whether it comes from import by reference or not
|
||||
// Turns on node visibility - if called node will be shown in output regardless
|
||||
// of whether it comes from import by reference or not
|
||||
Node.prototype.ensureVisibility = function () {
|
||||
this.nodeVisible = true;
|
||||
};
|
||||
//Turns off node visibility - if called node will NOT be shown in output regardless
|
||||
//of whether it comes from import by reference or not
|
||||
// Turns off node visibility - if called node will NOT be shown in output regardless
|
||||
// of whether it comes from import by reference or not
|
||||
Node.prototype.ensureInvisibility = function () {
|
||||
this.nodeVisible = false;
|
||||
};
|
||||
|
||||
@@ -122,7 +122,7 @@ Ruleset.prototype.eval = function (context) {
|
||||
// Evaluate mixin calls.
|
||||
for (i = 0; (rule = rsRules[i]); i++) {
|
||||
if (rule.type === "MixinCall") {
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
rules = rule.eval(context).filter(function(r) {
|
||||
if ((r instanceof Declaration) && r.variable) {
|
||||
// do not pollute the scope if the variable is
|
||||
@@ -136,7 +136,7 @@ Ruleset.prototype.eval = function (context) {
|
||||
i += rules.length - 1;
|
||||
ruleset.resetCache();
|
||||
} else if (rule.type === "RulesetCall") {
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
rules = rule.eval(context).rules.filter(function(r) {
|
||||
if ((r instanceof Declaration) && r.variable) {
|
||||
// do not pollute the scope at all
|
||||
@@ -529,7 +529,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
||||
// our new selector path
|
||||
newSelectorPath = [];
|
||||
|
||||
//construct the joined selector - if & is the first thing this will be empty,
|
||||
// construct the joined selector - if & is the first thing this will be empty,
|
||||
// if not newJoinedSelector will be the last set of elements in the selector
|
||||
if (beginningPath.length > 0) {
|
||||
newSelectorPath = utils.copyArray(beginningPath);
|
||||
@@ -559,7 +559,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
||||
newSelectorPath.push(newJoinedSelector);
|
||||
}
|
||||
|
||||
//put together the parent selectors after the join (e.g. the rest of the parent)
|
||||
// put together the parent selectors after the join (e.g. the rest of the parent)
|
||||
if (addPath.length > 1) {
|
||||
var restOfPath = addPath.slice(1);
|
||||
restOfPath = restOfPath.map(function (selector) {
|
||||
@@ -654,7 +654,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) {
|
||||
var nestedPaths = [], replaced, replacedNewSelectors = [];
|
||||
replaced = replaceParentSelector(nestedPaths, context, nestedSelector);
|
||||
hadParentSelector = hadParentSelector || replaced;
|
||||
//the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors
|
||||
// the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors
|
||||
for (k = 0; k < nestedPaths.length; k++) {
|
||||
var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);
|
||||
addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);
|
||||
|
||||
@@ -65,7 +65,7 @@ Unit.prototype.usedUnits = function() {
|
||||
var group, result = {}, mapUnit, groupName;
|
||||
|
||||
mapUnit = function (atomicUnit) {
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
if (group.hasOwnProperty(atomicUnit) && !result[groupName]) {
|
||||
result[groupName] = atomicUnit;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ var tree = require("../tree"),
|
||||
logger = require("../logger"),
|
||||
utils = require("../utils");
|
||||
|
||||
/*jshint loopfunc:true */
|
||||
/* jshint loopfunc:true */
|
||||
|
||||
var ExtendFinderVisitor = function() {
|
||||
this._visitor = new Visitor(this);
|
||||
@@ -137,7 +137,7 @@ ProcessExtendsVisitor.prototype = {
|
||||
|
||||
iterationCount = iterationCount || 0;
|
||||
|
||||
//loop through comparing every extend with every target extend.
|
||||
// loop through comparing every extend with every target extend.
|
||||
// a target extend is the one on the ruleset we are looking at copy/edit/pasting in place
|
||||
// e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one
|
||||
// and the second is the target.
|
||||
@@ -368,7 +368,7 @@ ProcessExtendsVisitor.prototype = {
|
||||
},
|
||||
extendSelector:function (matches, selectorPath, replacementSelector, isVisible) {
|
||||
|
||||
//for a set of matches, replace each match with the replacement selector
|
||||
// for a set of matches, replace each match with the replacement selector
|
||||
|
||||
var currentSelectorPathIndex = 0,
|
||||
currentSelectorPathElementIndex = 0,
|
||||
|
||||
@@ -15,8 +15,8 @@ CSSVisitorUtils.prototype = {
|
||||
for (var r = 0; r < bodyRules.length; r++) {
|
||||
rule = bodyRules[r];
|
||||
if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) {
|
||||
//the atrule contains something that was referenced (likely by extend)
|
||||
//therefore it needs to be shown in output too
|
||||
// the atrule contains something that was referenced (likely by extend)
|
||||
// therefore it needs to be shown in output too
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -139,9 +139,16 @@ ToCSSVisitor.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
visitAnonymous: function(anonymousNode, visitArgs) {
|
||||
if (!anonymousNode.blocksVisibility()) {
|
||||
anonymousNode.accept(this._visitor);
|
||||
return anonymousNode;
|
||||
}
|
||||
},
|
||||
|
||||
visitAtRuleWithBody: function(atRuleNode, visitArgs) {
|
||||
//if there is only one nested ruleset and that one has no path, then it is
|
||||
//just fake ruleset
|
||||
// if there is only one nested ruleset and that one has no path, then it is
|
||||
// just fake ruleset
|
||||
function hasFakeRuleset(atRuleNode) {
|
||||
var bodyRules = atRuleNode.rules;
|
||||
return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0);
|
||||
@@ -154,9 +161,9 @@ ToCSSVisitor.prototype = {
|
||||
|
||||
return nodeRules;
|
||||
}
|
||||
//it is still true that it is only one ruleset in array
|
||||
//this is last such moment
|
||||
//process childs
|
||||
// it is still true that it is only one ruleset in array
|
||||
// this is last such moment
|
||||
// process childs
|
||||
var originalRules = getBodyRules(atRuleNode);
|
||||
atRuleNode.accept(this._visitor);
|
||||
visitArgs.visitDeeper = false;
|
||||
@@ -214,13 +221,13 @@ ToCSSVisitor.prototype = {
|
||||
},
|
||||
|
||||
visitRuleset: function (rulesetNode, visitArgs) {
|
||||
//at this point rulesets are nested into each other
|
||||
// at this point rulesets are nested into each other
|
||||
var rule, rulesets = [];
|
||||
|
||||
this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot);
|
||||
|
||||
if (!rulesetNode.root) {
|
||||
//remove invisible paths
|
||||
// remove invisible paths
|
||||
this._compileRulesetPaths(rulesetNode);
|
||||
|
||||
// remove rulesets from this ruleset body and compile them separately
|
||||
@@ -246,7 +253,7 @@ ToCSSVisitor.prototype = {
|
||||
}
|
||||
visitArgs.visitDeeper = false;
|
||||
|
||||
} else { //if (! rulesetNode.root) {
|
||||
} else { // if (! rulesetNode.root) {
|
||||
rulesetNode.accept(this._visitor);
|
||||
visitArgs.visitDeeper = false;
|
||||
}
|
||||
@@ -256,7 +263,7 @@ ToCSSVisitor.prototype = {
|
||||
this._removeDuplicateRules(rulesetNode.rules);
|
||||
}
|
||||
|
||||
//now decide whether we keep the ruleset
|
||||
// now decide whether we keep the ruleset
|
||||
if (this.utils.isVisibleRuleset(rulesetNode)) {
|
||||
rulesetNode.ensureVisibility();
|
||||
rulesets.splice(0, 0, rulesetNode);
|
||||
@@ -347,14 +354,6 @@ ToCSSVisitor.prototype = {
|
||||
result.value = new tree.Value(comma);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
visitAnonymous: function(anonymousNode, visitArgs) {
|
||||
if (anonymousNode.blocksVisibility()) {
|
||||
return ;
|
||||
}
|
||||
anonymousNode.accept(this._visitor);
|
||||
return anonymousNode;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ function indexNodeTypes(parent, ticker) {
|
||||
// add .typeIndex to tree node types for lookup table
|
||||
var key, child;
|
||||
for (key in parent) {
|
||||
/*eslint guard-for-in: 0 */
|
||||
/* eslint guard-for-in: 0 */
|
||||
child = parent[key];
|
||||
switch (typeof child) {
|
||||
case "function":
|
||||
|
||||
@@ -148,7 +148,7 @@ testSheet = function (sheet) {
|
||||
});
|
||||
};
|
||||
|
||||
//TODO: do it cleaner - the same way as in css
|
||||
// TODO: do it cleaner - the same way as in css
|
||||
|
||||
function extractId(href) {
|
||||
return href.replace(/^[a-z-]+:\/+?[^\/]+/i, '') // Remove protocol & domain
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*jshint latedef: nofunc */
|
||||
/* jshint latedef: nofunc */
|
||||
|
||||
// This is used to copy a folder (the test/less/* files & sub-folders), adding a BOM to the start of each LESS and CSS file.
|
||||
// This is a based on the copySync method from fs-extra (https://github.com/jprichardson/node-fs-extra/).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*jshint latedef: nofunc */
|
||||
/* jshint latedef: nofunc */
|
||||
|
||||
module.exports = function() {
|
||||
var path = require('path'),
|
||||
@@ -45,21 +45,21 @@ module.exports = function() {
|
||||
queueRunning = false;
|
||||
function queue(func) {
|
||||
if (queueRunning) {
|
||||
//console.log("adding to queue");
|
||||
// console.log("adding to queue");
|
||||
queueList.push(func);
|
||||
} else {
|
||||
//console.log("first in queue - starting");
|
||||
// console.log("first in queue - starting");
|
||||
queueRunning = true;
|
||||
func();
|
||||
}
|
||||
}
|
||||
function release() {
|
||||
if (queueList.length) {
|
||||
//console.log("running next in queue");
|
||||
// console.log("running next in queue");
|
||||
var func = queueList.shift();
|
||||
setTimeout(func, 0);
|
||||
} else {
|
||||
//console.log("stopping queue");
|
||||
// console.log("stopping queue");
|
||||
queueRunning = false;
|
||||
}
|
||||
}
|
||||
@@ -282,7 +282,7 @@ module.exports = function() {
|
||||
if (err.stack) {
|
||||
process.stdout.write(err.stack + "\n");
|
||||
} else {
|
||||
//this sometimes happen - show the whole error object
|
||||
// this sometimes happen - show the whole error object
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,19 @@ functions.addMultiple({
|
||||
return less.AtRule(arg1.value, arg2.value);
|
||||
},
|
||||
"test-extend": function() {
|
||||
//TODO
|
||||
// TODO
|
||||
},
|
||||
"test-import": function() {
|
||||
//TODO
|
||||
// TODO
|
||||
},
|
||||
"test-media": function() {
|
||||
//TODO
|
||||
// TODO
|
||||
},
|
||||
"test-mixin-call": function() {
|
||||
//TODO
|
||||
// TODO
|
||||
},
|
||||
"test-mixin-definition": function() {
|
||||
//TODO
|
||||
// TODO
|
||||
},
|
||||
"test-ruleset-call": function() {
|
||||
return less.Combinator(' ');
|
||||
|
||||
Reference in New Issue
Block a user