mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Renamed --cache-buster option to --url-args
This commit is contained in:
@@ -28,7 +28,7 @@ var options = {
|
||||
strictUnits: false,
|
||||
globalVariables: '',
|
||||
modifyVariables: '',
|
||||
cacheBuster: ''
|
||||
urlArgs: ''
|
||||
};
|
||||
var cleancssOptions = {};
|
||||
var continueProcessing = true,
|
||||
@@ -243,9 +243,9 @@ args = args.filter(function (arg) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'cache-buster':
|
||||
case 'url-args':
|
||||
if (checkArgFunc(arg, match[2])) {
|
||||
options.cacheBuster = match[2];
|
||||
options.urlArgs = match[2];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -372,7 +372,7 @@ var parseLessFile = function (e, data) {
|
||||
maxLineLen: options.maxLineLen,
|
||||
strictMath: options.strictMath,
|
||||
strictUnits: options.strictUnits,
|
||||
cacheBuster: options.cacheBuster
|
||||
urlArgs: options.urlArgs
|
||||
});
|
||||
if (output) {
|
||||
ensureDirectory(output);
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
'cleancss', // whether to compress with clean-css
|
||||
'sourceMap', // whether to output a source map
|
||||
'importMultiple', // whether we are currently importing multiple copies
|
||||
'cacheBuster' // whether to add a cache buster param into url tokens
|
||||
'urlArgs' // whether to add args into url tokens
|
||||
];
|
||||
|
||||
tree.evalEnv = function(options, frames) {
|
||||
|
||||
@@ -32,15 +32,15 @@ tree.URL.prototype = {
|
||||
|
||||
val.value = ctx.normalizePath(val.value);
|
||||
|
||||
// Add cache buster if enabled
|
||||
if (ctx.cacheBuster) {
|
||||
// Add url args if enabled
|
||||
if (ctx.urlArgs) {
|
||||
if (!val.value.match(/^\s*data:/)) {
|
||||
var delimiter = val.value.indexOf('?') === -1 ? '?' : '&';
|
||||
var cacheBuster = delimiter + ctx.cacheBuster;
|
||||
var urlArgs = delimiter + ctx.urlArgs;
|
||||
if (val.value.indexOf('#') !== -1) {
|
||||
val.value = val.value.replace('#', cacheBuster + '#');
|
||||
val.value = val.value.replace('#', urlArgs + '#');
|
||||
} else {
|
||||
val.value += cacheBuster;
|
||||
val.value += urlArgs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,6 @@ lessTester.runTestSet({globalVars: true, banner: "/**\n * Test\n */\n"}, "glob
|
||||
null, null, null, function(name) { return path.join('test/less/', name) + '.json'; });
|
||||
lessTester.runTestSet({modifyVars: true}, "modifyVars/",
|
||||
null, null, null, function(name) { return path.join('test/less/', name) + '.json'; });
|
||||
lessTester.runTestSet({cacheBuster: '424242'}, "cache-buster/");
|
||||
lessTester.runTestSet({urlArgs: '424242'}, "url-args/");
|
||||
|
||||
lessTester.testNoOptions();
|
||||
|
||||
Reference in New Issue
Block a user