Hey, started migrating a project to Sage 11.
I have created a fresh project and pulled required files across.
When after running a build no JS or CSS is being loaded on the front-end.
Any advice?
Can’t see where CSS and JS is being enqueued in this theme setup.
Thanks,
Jordan
ben
2
CSS and JS are not enqueued in Sage 11 because the assets are loaded via the @vite
Blade directive:
I have created a fresh project and pulled required files across.
This shouldn’t happen on a fresh project with no modifications. Have you attempted just a stock Sage install before making changes?
Hey Ben,
Thanks for the speedy reply.
My fault this one, I overwrote the head.blade.php file with the one from my Sage 9 project.
I have added the vite directive and made progress but a new error has now appeared.
Unable to locate file in Vite manifest: resources/css/app.css.
More context, I have followed the site docs to remove tailwind and use bootstrap as this is a project from pre tailwind.
Current Vite config below:
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import { wordpressPlugin, wordpressThemeJson } from '@roots/vite-plugin';
export default defineConfig({
base: '[redacted]',
plugins: [
laravel({
input: [
'resources/css/app.scss',
'resources/js/app.js',
'resources/css/editor.scss',
'resources/js/editor.js',
],
refresh: true,
}),
wordpressPlugin(),
// Generate the theme.json file in the public/build/assets directory
// based on the Tailwind config and the theme.json file from base theme folder
wordpressThemeJson({
disableTailwindColors: true,
disableTailwindFonts: true,
disableTailwindFontSizes: true,
}),
],
resolve: {
alias: {
'@scripts': '/resources/js',
'@styles': '/resources/css',
'@fonts': '/resources/fonts',
'@images': '/resources/images',
},
},
})
ben
4
Fixing the guide right now, but change app.css
to app.scss
in the @vite()
directive in resources/views/layouts/app.blade.php
Amazing thanks for the help!
1 Like
Can you dumb this down for me?
Does this mean we are no longer going to have to do stuff like this?
if (is_front_page()) {
bundle('home')->enqueue();
}
ben
7
The bundle()
function in Acorn is for bud.js
Feel free to open a new topic if you have questions, but I’m closing this one since it’s solved
1 Like