Sorry I’m here again. I updated my package.json
and changed my bud.config.js
to the example you’ve shown me. Now everything seems to work, but the assets (images). These have the same problem as above, they are loaded like this example: http://staging.tropaholic.be/app/themes/tropaholic/public/app/themes/tropaholic/public/images/icons/profile.59e7af.svg
In my template I use the asset like this <img class="w-7" src="@asset('images/icons/profile.svg')" alt="Profile">
. However the marker I’m using in Google Maps is being resolved using \Roots\asset('images/marker.png')
.
package.json
{
"name": "sage",
"private": true,
"browserslist": [
"extends @wordpress/browserslist-config"
],
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"dev": "bud dev",
"build": "bud build",
"lint": "npm run lint:js && npm run lint:css",
"lint:js": "eslint resources/scripts",
"lint:css": "stylelint \"resources/**/*.{css,scss,vue}\"",
"test": "npm run lint",
"translate": "npm run translate:pot && npm run translate:js",
"translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include=\"app,resources\"",
"translate:js": "wp i18n make-json ./resources/lang --pretty-print"
},
"devDependencies": {
"@roots/bud": "5.8.4",
"@roots/bud-eslint": "5.8.4",
"@roots/bud-prettier": "5.8.4",
"@roots/bud-stylelint": "5.8.4",
"@roots/bud-tailwindcss": "5.8.4",
"@roots/eslint-config": "5.8.4",
"@roots/sage": "5.8.4"
},
"dependencies": {
"@alpinejs/collapse": "^3.9.2",
"@fancyapps/fancybox": "^3.5.7",
"@vidstack/player": "^1.4.0",
"alpinejs": "^3.9.0",
"axios": "^0.26.0",
"google-maps": "^4.3.3",
"lit": "^2.2.2"
}
}
bud.config.js
/**
* @typedef {import('@roots/bud').Bud} bud
*
* @param {bud} app
*/
module.exports = async (app) => {
app
/**
* Application entrypoints
*
* Paths are relative to your resources directory
*/
.entry({
app: ["@scripts/app", "@styles/app"],
editor: ["@scripts/editor", "@styles/editor"],
})
.setPublicPath("/app/themes/tropaholic/public/")
/**
* These files should be processed as part of the build
* even if they are not explicitly imported in application assets.
*/
.assets([
{
from: app.path("@src/images"),
to: app.path("@dist/images/@file"),
},
{
from: app.path("@src/fonts"),
to: app.path("@dist/fonts/@file"),
},
])
/**
* Target URL to be proxied by the dev server.
*
* This is your local dev server.
*/
.proxy('http://tropaholic.test')
/**
* Development URL
*/
.serve('http://tropaholic.test:3000')
/**
* These files will trigger a full page reload
* when modified.
*/
.watch([
'tailwind.config.js',
'resources/views/**/*.blade.php',
'app/View/**/*.php',
]);
};
Thanks in advance!