Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/bless/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

var path = require('path'),
fs = require('fs'),
crypto = require('crypto'),
bless = exports,
cacheBuster = '?z=' + new Date().getTime();
cacheBusterTimestamp = new Date().getTime();

bless.Parser = function Parser(env) {
this.env = env = env || {};
var output = this.env.output,
options = this.env.options;
options = this.env.options,
cacheBusterParam = options.cacheBusterParam ? ('?z=' + options.cacheBusterParam) : ('?z=' + cacheBusterTimestamp);

//
// The Parser
Expand Down Expand Up @@ -93,7 +95,7 @@ bless.Parser = function Parser(env) {
for(var k=1; k<=filesLength; k++) {
var outputFilename = filename + '-blessed' + k + ext;
if (options.cacheBuster) {
outputFilename += cacheBuster;
outputFilename += cacheBusterParam;
}
var importStr = '@import url(\'' + outputFilename + '\');';
importStr = options.compress ? importStr : importStr + '\n';
Expand All @@ -119,10 +121,11 @@ bless.Parser.cleanup = function (options, output, callback) {
dir = path.dirname(output),
ext = path.extname(output),
filename = path.basename(output, ext),
fileRegex = filename + '-blessed' + '(\\d+)' + ext;
fileRegex = filename + '-blessed' + '(\\d+)' + ext,
cacheBusterParam = options.cacheBusterParam ? ('?z=' + options.cacheBusterParam) : ('?z=' + cacheBusterTimestamp);

if (options.cacheBuster) {
fileRegex += cacheBuster;
fileRegex += cacheBusterParam;
}

var importRegex = '@import url\\(\'(' + fileRegex + '\')\\);';
Expand Down