Skip to content

Commit

Permalink
Allows relative output paths to be used for sass calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Smith committed Feb 4, 2021
1 parent 1452bde commit 617e870
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ class Preprocessor {
enforce: true,
type: 'css/mini-extract'
};
const path = File.stripPublicDir(output.relativePathWithoutExtension());

this.chunks.add(name, output.normalizedOutputPath(), tests, attrs);
this.chunks.add(name, path, tests, attrs);
}
}

Expand Down
40 changes: 40 additions & 0 deletions test/integration/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { chromium } from 'playwright';
import webpack, { setupVueAliases } from '../helpers/webpack';

import '../helpers/mix';
import assert from '../helpers/assertions';

/** @type {import("playwright").Browser} */
let browser;
Expand Down Expand Up @@ -40,6 +41,45 @@ test('compiling just js', async t => {
await assertProducesLogs(t, ['loaded: app.js']);
});

test('compiling css into relative directory', async t => {
setupVueAliases(3);

// Build a simple mix setup
mix.sass(
'test/fixtures/integration/src/css/app.scss',
'../../../integration/fixture/public/css/app.css'
);

await webpack.compile();
assert.fileExists(`test/integration/fixture/public/css/app.css`, t);
await assertProducesLogs(t, [
'loaded: app.js',
'run: app.js',
'loaded: dynamic.js',
'run: dynamic.js',
'style: rgb(255, 119, 0)',
'style: rgb(119, 204, 51)'
]);
});

test('compiling css using public directory in destination', async t => {
setupVueAliases(3);

// Build a simple mix setup
mix.sass('test/fixtures/integration/src/css/app.scss', 'dist/css/app.css');

await webpack.compile();
assert.fileExists(`test/fixtures/integration/dist/css/app.css`, t);
await assertProducesLogs(t, [
'loaded: app.js',
'run: app.js',
'loaded: dynamic.js',
'run: dynamic.js',
'style: rgb(255, 119, 0)',
'style: rgb(119, 204, 51)'
]);
});

test('compiling js and css together', async t => {
setupVueAliases(3);

Expand Down

0 comments on commit 617e870

Please sign in to comment.