I have just upgraded from sage 10 to the new beta 2 release with bud.
I am getting this error when running npm run dev
✘ Module not found: Error: Can't resolve './fonts/Buffalo-Regular.ttf' in './resources/styles'
✘ Module not found: Error: Can't resolve './images/chevron.svg' in './resources/styles'
I’ve also got sass installed using yarn add @roots/bud-sass --dev
There are many more messages like the above – those two are just examples. It seems to be only the images and fonts folder though.
Thank you! Do you know if you’re using Bud v5 or v5.2.0? Beta 2 shipped with v5, but there’s been a couple updates since with v5.1.0 and v5.2.0 which should have these issues resolved
The problem seems to happen as soon as I change app.css to app.scss. It compiles fine if it’s not using sass. My bud file for reference:
/**
* @typedef {import('@roots/bud').Bud} bud
*
* @param {bud} app
*/
module.exports = (app) =>
app
/**
* Application entrypoints
*
* Paths are relative to your resources directory
*/
.entry({
app: ['scripts/app.js', 'styles/app.scss'],
editor: ['scripts/editor.js', 'styles/editor.css'],
})
/**
* These files should be processed as part of the build
* even if they are not explicitly imported in application assets.
*/
.assets([app.path('src', 'images')], [app.path('src', 'fonts')])
/**
* These files will trigger a full page reload
* when modified.
*/
.watch([
'tailwind.config.js',
'resources/views/**/*.blade.php',
'app/View/**/*.php',
])
/**
* Target URL to be proxied by the dev server.
*
* This is your local dev server.
*/
.proxy('http://demo.test');
Hey! Wanted to follow up here as I had similar issues that I fixed and thought it could be useful:
In mix-based builds in sage < 10 (including the beta), you needed to reference the final path in .scss assets – for instance : url('../fonts/fontello.woff);, even if your .scss file was not siblings with the the /fonts directory. This is because the compiled file kept the same url, so you needed the correct reference between compiled assets.
Bud resolves the reference during compliation, so you can use the correct path between the assets in your src/ folder. The path will be correctly updated in the output!
Here’s an example:
Let’s say you have a .scss file ./src/styles/core/typography.scss.
It’s trying to load the font ./src/fonts/fontello.woff.
Your reference in the .scss file would be url('../../../fonts/fontello.woff');. (Eventually, we should get aliases to work here, right?)
Just wanted to let you know that aliases do work, and if you are using the @roots/sage Bud extension you can use the @fonts alias. My font imports look like this resources/styles/_fonts.scss