koel/webpack.mix.js

30 lines
873 B
JavaScript
Raw Normal View History

2017-08-25 00:30:57 +00:00
const mix = require('laravel-mix')
const fs = require('fs')
2017-02-14 06:53:02 +00:00
mix.config.detectHotReloading()
if (mix.config.hmr) {
2017-08-25 00:30:57 +00:00
// There's a bug with Mix/copy plugin which prevents HMR from working:
// https://github.com/JeffreyWay/laravel-mix/issues/150
console.log('In HMR mode. If assets are missing, Ctr+C and run `yarn dev` first.')
2017-02-14 06:53:02 +00:00
2017-08-25 00:30:57 +00:00
// Somehow public/hot isn't being removed by Mix. We'll handle it ourselves.
process.on('SIGINT', () => {
try {
fs.unlinkSync(mix.config.publicPath + '/hot')
} catch (e) {
}
process.exit()
})
2017-02-14 06:53:02 +00:00
} else {
2017-08-25 00:30:57 +00:00
mix.copy('resources/assets/img', 'public/img', false)
.copy('node_modules/font-awesome/fonts', 'public/fonts', false)
2017-02-14 06:53:02 +00:00
}
mix.js('resources/assets/js/app.js', 'public/js')
2017-08-25 00:30:57 +00:00
.sass('resources/assets/sass/app.scss', 'public/css')
2017-02-14 06:53:02 +00:00
if (mix.config.inProduction) {
2017-08-25 00:30:57 +00:00
mix.version()
mix.disableNotifications()
2017-02-14 06:53:02 +00:00
}