I am working with Sage 10, and working on the bud.config.js
to try and allow only browser sync if the user is running a particular script in the package.json
.
Basically, for our dev/staging sites, the frontend developers want the ability to see the source-maps, but with the way the Sage 10’s package.json
is outlined, you have either yarn bud or yarn bud production. The former will serve the site, which is great locally, but the latter will minimize.
I know that I can prolly use CLI to tag onto the script, but I fear this may cause a lot of confusion and push back from my frontend development team of being too complex.
Is there a way I can set specific flags in the package.json
scripts to execute the proxy/serve methods in the bud.config.js
file, OR set up my own custom mode, instead of just development or production? I also believe the option of using a .env
file would also be out, again due to adding another layer of complexity.
This is my package.json
currently:
"scripts": {
"dev": "bud dev ",
"build": "bud build",
"production": "bud build production",
}
And here is my bud.config.js
module.exports = async (bud) => {
bud
.alias({
"@sageAdmin": "@src/admin_assets",
// React script alias'
"@sageReact": "@src/react",
"@sageRedux": "@src/react/Redux",
"@reactComponent": "@src/react/Components",
"@reactPages": "@src/react/Pages",
"@reactUtil": "@src/react/Util"
})
.entry({
app: ["@scripts/app", "@styles/app"],
editor: ["@scripts/editor", "@styles/editor"],
admin: ["@sageAdmin/css/admin_styles", "@sageAdmin/js/sage-admin"],
sageReact: ["@sageReact/app"],
blog: ['@sageReact/Pages/Blog/blog-index'],
})
.assets(["images", "fonts"])
.watch(
[
"app/**/*",
"resources/react/**/*",
"resources/scripts/**/*",
"resources/styles/**/*",
"resources/views/**/*"
]
)
.proxy("https://boilerplate8.1.test")
.serve("http://localhost:3000")
.setPublicPath("/app/themes/sage/public/")
.wpjson
.settings({})
.useTailwindColors()
.useTailwindFontFamily()
.useTailwindFontSize()
.enable()
.when(bud.isDevelopment, bud => bud.devtool())
};