Skip to content

Instantly share code, notes, and snippets.

@Lelectrolux
Forked from thecrypticace/webpack.mix.js
Created September 29, 2020 13:41
Show Gist options
  • Save Lelectrolux/e2f51bf65947624ecccc76ec0f5365f3 to your computer and use it in GitHub Desktop.
Save Lelectrolux/e2f51bf65947624ecccc76ec0f5365f3 to your computer and use it in GitHub Desktop.
Mix + custom API for separate builds
const mix = require("laravel-mix")
mix.site = (id, callback) => {
if (!process.env.SITE || process.env.SITE === id) {
return callback()
}
};
mix.site('admin', () => {
mix.js("resources/js/admin/app.js", "public/js/admin.js")
mix.sass("resources/sass/admin/app.scss", "public/css/admin.css")
})
mix.site('app', () => {
mix.js("resources/js/app.js", "public/js")
mix.sass("resources/sass/app.scss", "public/css/app.css")
})
// run using:
// SITE=admin yarn run dev
// SITE=app yarn run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment