Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
borodean committed Jan 3, 2015
2 parents 58dac4f + fb2fe46 commit 5b20e8d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports = function (options) {
} else {
assetUrl.search = '?';
}
assetUrl.search += options.cachebuster(assetPath);
assetUrl.search += options.cachebuster(resolvePath(assetPath));
}
return cssesc(url.format(assetUrl));
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-assets",
"version": "1.1.1",
"version": "1.1.2",
"description": "PostCSS plugin to manage assets",
"author": "Vadim Borodean <[email protected]>",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/cachebuster.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
body {
background: url('test/fixtures/alpha/kateryna.jpg');
background: url('test/fixtures/alpha/kateryna.jpg?foo=bar');
background: url('kateryna.jpg');
}
5 changes: 3 additions & 2 deletions test/fixtures/cachebuster.expected.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
body {
background: url('/test/fixtures/alpha/kateryna.jpg?20');
background: url('/test/fixtures/alpha/kateryna.jpg?foo=bar&20');
background: url('/test/fixtures/alpha/kateryna.jpg?43');
background: url('/test/fixtures/alpha/kateryna.jpg?foo=bar&43');
background: url('/test/fixtures/alpha/kateryna.jpg?43');
}
15 changes: 9 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,20 @@ test('dimensions', function (t) {
});

test('cachebuster', function (t) {
var options = { cachebuster: true };
var options = {
cachebuster: true,
loadPaths: ['test/fixtures/alpha/']
};
var a = process('cachebuster', options);
modifyFile('test/fixtures/alpha/kateryna.jpg');
var b = process('cachebuster', options);
t.notEqual(a, b, 'busts cache');

compareFixtures(t, 'cachebuster', 'accepts buster function', {
cachebuster: function (path) {
return path.length.toString(16);
}
});
options.cachebuster = function (path) {
return path.length.toString(16);
};

compareFixtures(t, 'cachebuster', 'accepts buster function', options);

t.end();
});

0 comments on commit 5b20e8d

Please sign in to comment.