Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Img conflict name #3157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/builder/webpack-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = function (mix) {
if (!/node_modules|bower_components/.test(path)) {
return (
mix.config.fileLoaderDirs.images +
'/[name].[ext]?[hash]'
'/[name].[hash:8].[ext]?[hash:8]'
);
}

Expand Down
6 changes: 2 additions & 4 deletions src/components/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ class Options {
if ('extractVueStyles' in options) {
messages.push({
type: 'warn',
text:
'The option extractVueStyles has been moved. Please pass the extractStyles option to mix.vue() instead.'
text: 'The option extractVueStyles has been moved. Please pass the extractStyles option to mix.vue() instead.'
});
}

if ('globalVueStyles' in options) {
messages.push({
type: 'warn',
text:
'The option globalVueStyles has been moved. Please pass the globalStyles option to mix.vue() instead.'
text: 'The option globalVueStyles has been moved. Please pass the globalStyles option to mix.vue() instead.'
});
}

Expand Down
14 changes: 11 additions & 3 deletions test/features/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ test('it resolves image- and font-urls and distinguishes between them even if we
// Then we expect the css to be built
t.true(File.exists(`test/fixtures/app/dist/css/font-and-image.css`));
// Along with the referred image in the images folder
t.true(File.exists(`test/fixtures/app/dist/images/img.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img.66162863.svg`));
// And the referred fonts in the fonts folder
t.true(File.exists(`test/fixtures/app/dist/fonts/font.svg`));
t.true(File.exists(`test/fixtures/app/dist/fonts/awesome.svg`));
// And we expect the image NOT to be in the fonts folder:
t.false(File.exists(`test/fixtures/app/dist/fonts/img.svg`));
// And the fonts NOT to be in the image folder
t.false(File.exists(`test/fixtures/app/dist/images/font.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/awesome.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/font.66162863.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/awesome.66162863.svg`));
});

test('it accepts images with the same file name but with different paths', async t => {
mix.js(`test/fixtures/app/src/js/app-import-images-same-file-name.js`, 'js');
await webpack.compile();

t.true(File.exists(`test/fixtures/app/dist/images/img.66162863.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img.9e0d380b.svg`));
});
8 changes: 4 additions & 4 deletions test/features/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ test('Sass url resolution can be configured per-file', async t => {
t.true(File.exists(`test/fixtures/app/dist/css/font-and-image.css`));
t.true(File.exists(`test/fixtures/app/dist/css/image.css`));

t.false(File.exists(`test/fixtures/app/dist/images/img.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img2.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/img.66162863.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img2.66162863.svg`));

t.false(File.exists(`test/fixtures/app/dist/fonts/font.svg`));
t.false(File.exists(`test/fixtures/app/dist/fonts/awesome.svg`));
t.false(File.exists(`test/fixtures/app/dist/fonts/font.66162863.svg`));
t.false(File.exists(`test/fixtures/app/dist/fonts/awesome.66162863.svg`));
});

test('Sass url resolution can be disabled: globally (before)', async t => {
Expand Down
4 changes: 2 additions & 2 deletions test/features/setResourceRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ test('mix.setResourceRoot() rewrites processed asset urls', async t => {
await webpack.compile();

t.true(File.exists(`test/fixtures/app/dist/css/app-and-image.css`));
t.true(File.exists(`test/fixtures/app/dist/images/img.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img.66162863.svg`));

assert.fileMatchesCss(
`test/fixtures/app/dist/css/app-and-image.css`,
`.app {
color: red;
background-image: url(https://www.example.com/images/img.svg?66162863e7583212a5d4fd6cdc2426ed);
background-image: url(https://www.example.com/images/img.66162863.svg?66162863);
}`,
t
);
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/app/src/img/another-img/img.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions test/fixtures/app/src/js/app-import-images-same-file-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Img1 from '../img/img.svg';
import Img2 from '../img/another-img/img.svg';