Answer the question
In order to leave comments, you need to log in
How to increase Google page speed on a Laravel/Vue site, given that most of the blocks on the main page are Vue components?
Good afternoon.
Image score improved with nginx image filter
But bad performance remains, especially for mobile:
Interaction load time 14.4 sec.
Large content rendering 12.2 sec.
Download speed index 5.7 sec.
Google suggests:
1) Set up keyword preloading (estimated savings: 6.81 s)
I converted
<script src="{{ mix('front/js/app.js', 'build') }}"></script>
<link rel="preload" href="{{ mix('front/js/app.js', 'build') }}" as="script">
<script src="{{ mix('front/js/app.js', 'build') }}"></script>
Vue.component('register', require('./components/Register.vue'));
require('jquery-mask-plugin');
require('./bootstrap');
window.Vue = require('vue');
window.Vuex = require('vuex');
Vue.use(Vuelidate);
Vue.use(Storage, {
namespace: 'vuejs__',
name: 'ls',
storage: 'local',
});
...
const mix = require('laravel-mix');
require('laravel-mix-purgecss');
mix
.setPublicPath('public/build')
.setResourceRoot('build')
.js('resources/js/app.js', 'front/js')
.sass('resources/sass/app.scss', 'front/css')
.options({
processCssUrls: false
})
.purgeCss()
.js('resources/js/admin/app.js', 'admin/js')
.sass('resources/sass/admin/app.scss', 'admin/css')
.options({
processCssUrls: false
})
;
mix.options({
terser: {},
});
mix.version();
mix.copy('./resources/fonts', './public/build/front/fonts');
mix.copy('./node_modules/@fortawesome/fontawesome-free/webfonts', './public/build/front/webfonts');
mix.copy('./node_modules/@fortawesome/fontawesome-free/webfonts', './public/build/admin/webfonts');
let iconsArr = [
'checked.svg',
'setting.svg',
'checked.svg',
];
for (const elem of iconsArr) {
const srcPath = `./resources/images/${elem}`;
mix.copy(srcPath, `./public/build/front/images/${elem}`);
}
Answer the question
In order to leave comments, you need to log in
Look towards Server-Side Rendering https://ssr.vuejs.org/
When you first load the page, serve the already generated html. Or maybe only bots
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question