Changeset View
Changeset View
Standalone View
Standalone View
src/webpack.mix.js
/* | /* | ||||
|-------------------------------------------------------------------------- | |-------------------------------------------------------------------------- | ||||
| Mix Asset Management | | Mix Asset Management | ||||
|-------------------------------------------------------------------------- | |-------------------------------------------------------------------------- | ||||
| | | | ||||
| Mix provides a clean, fluent API for defining some Webpack build steps | | Mix provides a clean, fluent API for defining some Webpack build steps | ||||
| for your Laravel application. By default, we are compiling the Sass | | for your Laravel application. By default, we are compiling the Sass | ||||
| file for the application as well as bundling up all the JS files. | | file for the application as well as bundling up all the JS files. | ||||
| | | | ||||
*/ | */ | ||||
const { spawn } = require('child_process'); | const { spawn } = require('child_process'); | ||||
const glob = require('glob'); | const glob = require('glob'); | ||||
const mix = require('laravel-mix'); | const mix = require('laravel-mix'); | ||||
mix.webpackConfig({ | |||||
resolve: { | |||||
alias: { | |||||
'jquery$': 'jquery/dist/jquery.slim.js', | |||||
} | |||||
} | |||||
}) | |||||
mix.js('resources/js/user/app.js', 'public/js/user.js').vue() | mix.js('resources/js/user/app.js', 'public/js/user.js').vue() | ||||
.js('resources/js/admin/app.js', 'public/js/admin.js').vue() | .js('resources/js/admin/app.js', 'public/js/admin.js').vue() | ||||
.js('resources/js/reseller/app.js', 'public/js/reseller.js').vue() | .js('resources/js/reseller/app.js', 'public/js/reseller.js').vue() | ||||
mix.before(() => { | mix.before(() => { | ||||
spawn('php', ['resources/build/before.php'], { stdio: 'inherit' }) | spawn('php', ['resources/build/before.php'], { stdio: 'inherit' }) | ||||
}) | }) | ||||
glob.sync('resources/themes/*/', {}).forEach(fromDir => { | glob.sync('resources/themes/*/', {}).forEach(fromDir => { | ||||
const toDir = fromDir.replace('resources/themes/', 'public/themes/') | const toDir = fromDir.replace('resources/themes/', 'public/themes/') | ||||
mix.sass(fromDir + 'app.scss', toDir) | mix.sass(fromDir + 'app.scss', toDir) | ||||
.sass(fromDir + 'document.scss', toDir); | .sass(fromDir + 'document.scss', toDir); | ||||
}) | }) |