Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/lib/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const isUrlWithoutPathname = (assetUrl) => {
* @returns {Boolean}
*/
const isUrlShouldBeIgnored = (assetUrl, options) => {
return isUrlWithoutPathname(assetUrl) || (assetUrl[0] === '/' && !options.basePath);
const isAbsolutePath = assetUrl[0] === '/';
const isStartsWithTilde = assetUrl[0] === '~';

return isUrlWithoutPathname(assetUrl) || ((isAbsolutePath || isStartsWithTilde) && !options.basePath);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/type/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getAssetsPath = paths.getAssetsPath;
const normalize = paths.normalize;

const getHashName = (file, options) =>
(options && options.append ? (path.basename(file.path, path.extname(file.path)) + '_') : '')
(options && options.append ? (`${path.basename(file.path, path.extname(file.path))}_`) : '')
+ calcHash(file.contents, options)
+ path.extname(file.path);

Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/skip-urls-with-tilde.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: url("~one"), url("~./two"), url("~@three"), url("~@four/qwe");
}
3 changes: 3 additions & 0 deletions test/fixtures/skip-urls-with-tilde.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: url("~one"), url("~./two"), url("~@three"), url("~@four/qwe");
}
5 changes: 5 additions & 0 deletions test/type/copy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
compareFixtures(
'skip-urls-with-tilde',
'should skip URLs with tilde'
);

describe('copy without assetsPath', () => {
const opts = {
url: 'copy'
Expand Down
5 changes: 5 additions & 0 deletions test/type/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ describe('inline', () => {
postcssOpts
);

compareFixtures(
'skip-urls-with-tilde',
'should skip URLs with tilde'
);

it('should inline url from dirname(from)', () => {
const css = processedCss('fixtures/inline-from', opts, postcssOpts);

Expand Down
4 changes: 4 additions & 0 deletions test/type/rebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ describe('rebase', () => {
opts,
{ from: 'test/fixtures/here', to: 'there' }
);
compareFixtures(
'skip-urls-with-tilde',
'should skip URLs with tilde'
);
});