Skip to content

Instantly share code, notes, and snippets.

@thecrypticace
Created September 24, 2020 13:02
Show Gist options
  • Save thecrypticace/52b5e54c74bd53077a058ba1cb958d9b to your computer and use it in GitHub Desktop.
Save thecrypticace/52b5e54c74bd53077a058ba1cb958d9b 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