I’m trying to figure out how to configure bud properly without Sage.
Paths
How do the below paths get resolved?
app: ["@scripts/app", "@styles/app"],
editor: ["@scripts/editor", "@styles/editor"],
I know a webpack.config.js is being generated, but where can I configure the aliases in the bud config?
For now I set the paths relative to the file and bud now picks them up.
Aliases
Edit: Just found this, but setting an alias doesn’t change much, builds are still in ‘src’ and ‘dist’…
Edit2: Also found this, but the example also uses the default paths.
And another thing, I’ve added @roots/bud-preset-wordpress
and @roots/bud-sass
, yet I still get the following error, am I missing a setting? This only happens when I divert from the default src
folder.
ERROR ./assets/styles/app.scss
Module parse failed: Unexpected token (1:5)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Watching
Also, my files aren’t being watched… I have a folder with twig templates (theme_folder/views
), but when I edit these, the build process is not getting triggered. My bud.config.mjs
settings are:
bud.config.mjs
// @ts-check
/**
* Build configuration
*
* @see {@link https://bud.js.org/guides/getting-started/configure}
* @param {import('@roots/bud').Bud} app
*/
export default async (app) => {
app
/**
* Application entrypoints
*/
.entry({
app: ["./assets/scripts/app.js", "./assets/styles/app.scss"],
editor: ["./assets/scripts/editor.js", "./assets/styles/editor.scss"],
})
/**
* Directory contents to be included in the compilation
*/
.assets(["images"])
/**
* Matched files trigger a page reload when modified
*/
.watch(["views/**/*", "*.php"])
/**
* Proxy origin (`WP_HOME`)
*/
.proxy("https://sitename.com")
/**
* Development origin, don't forget to add '127.0.0.1 bud' to your hosts
*/
.serve("http://bud:3000")
/**
* URI of the `public` directory
*/
.setPublicPath("/app/themes/sitename/assets/");
};
package.json
{
"devDependencies": {
"@roots/bud": "^6.3.5",
"@roots/bud-preset-wordpress": "^6.3.5",
"@roots/bud-sass": "^6.3.5"
},
"scripts": {
"dev": "bud dev",
"build": "bud build"
}
}
Thanks!