Skip to content

Instantly share code, notes, and snippets.

@fredericpfisterer
Created May 16, 2018 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredericpfisterer/e4bcddeb8c1ee69ee9031bedaf140488 to your computer and use it in GitHub Desktop.
Save fredericpfisterer/e4bcddeb8c1ee69ee9031bedaf140488 to your computer and use it in GitHub Desktop.
Wordplate Laravel Mix config file
const mix = require("laravel-mix");
require("dotenv").config();
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for your application, as well as bundling up your JS files.
|
*/
const theme = process.env.WP_THEME;
mix.setResourceRoot("../");
mix.setPublicPath(`public/themes/${theme}/assets`);
mix.js("resources/assets/scripts/app.js", "scripts");
mix.sass("resources/assets/styles/app.scss", "styles");
mix.browserSync({
proxy: process.env.BROWSER_SYNC_PROXY,
files: [
`public/themes/${theme}/**/*.php`,
`public/themes/${theme}/**/*.js`,
`public/themes/${theme}/**/*.css`
],
browser: "Google Chrome"
});
mix.disableNotifications();
if (!mix.inProduction()) {
mix.webpackConfig({
devtool: 'source-map'
})
.sourceMaps()
}
else{
mix.version();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment