Last active
May 9, 2022 12:06
-
-
Save mohammad-erdin/e06654873f1ece8d563ff3ff93d50825 to your computer and use it in GitHub Desktop.
Laravel Mix Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-param-reassign */ | |
// definition | |
const mix = require('laravel-mix'); | |
const glob = require('glob'); | |
const fs = require('fs'); | |
require('laravel-mix-php-serve'); | |
mix | |
.options({ | |
clearConsole: false, | |
manifest: false, | |
processCssUrls: false, | |
}) | |
.webpackConfig({ | |
infrastructureLogging: { | |
level: 'none', | |
}, | |
}) | |
.before(() => { | |
fs.rmSync('./public/app', { recursive: true, force: true }); | |
}) | |
.sourceMaps(true, 'source-map') | |
.disableNotifications() | |
.serve({ | |
artisan: false, | |
host: 'localhost', | |
port: '8080', | |
target: 'public', | |
verbose: false, | |
}) | |
.browserSync({ | |
proxy: 'http://localhost:8080', | |
files: [ | |
'module/**/*.php', | |
'public/app/**/*.css', | |
'public/app/**/*.js', | |
'public/vendor/goy-framework/dist/**/*', | |
], | |
injectChanges: false, | |
open: !true, | |
notify: false, | |
}); | |
glob.sync('./module/**/Assets/js/**/*.js') | |
.map((file) => mix.js(file, file.replace('module/', 'public/app/').replace('.js', '.min.js'))); | |
glob.sync('./module/**/Assets/**/!(_*).scss') | |
.map((file) => mix.sass(file, file.replace('module/', 'public/app/').replace('.scss', '.css'))); | |
if (mix.inProduction()) { | |
glob.sync('./module/**/Assets/{font,fonts,img,imgs,images}/**/*.*') | |
.map((file) => mix.copy(file, file.replace('module/', 'public/app/'))); | |
} | |
mix.override((config) => { | |
config.plugins = config.plugins.filter((plugin) => plugin.constructor.name !== 'BuildOutputPlugin'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment