@nuxtjs/critters dependency to your projectyarn add @nuxtjs/critters # or npm install @nuxtjs/critters
@nuxtjs/critters to the modules section of nuxt.config.js{
modules: [
'@nuxtjs/critters',
],
}
Nuxt has a number of ways to optimize your CSS in production:
cssnano in the build step to minify CSS rulespurgecss to remove unused CSS rules from your bundle.@nuxtjs/critters you can now extract CSS files and load them separately, just inlining the CSS necessary to render the page.You can override the @nuxtjs/critters defaults like this:
// nuxt.config.js
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: ['@nuxtjs/critters'],
critters: {
// Options passed directly to critters: https://github.com/GoogleChromeLabs/critters#critters-2
config: {
// Default: 'media'
preload: 'swap',
},
},
})
yarn installyarn devWe use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.