Renamed --cache-buster option to --url-args

This commit is contained in:
Luca Bernardo Ciddio
2014-01-18 19:26:27 -08:00
parent 958716160f
commit d6244cb3f9
6 changed files with 11 additions and 11 deletions

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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;
}
}
}

View File

@@ -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();