Critters
CSS optimization using critters for Nuxt
Install / Use
/learn @nuxt-modules/CrittersREADME
@nuxtjs/critters
CSS optimization using beasties (formerly critters) for Nuxt
Features
- Zero-configuration required
- Enables CSS Extraction
- Critical CSS automatically injected to page
- Works with Nitro prerendering
Quick setup
- Add
@nuxtjs/crittersdependency to your project
yarn add @nuxtjs/critters # or npm install @nuxtjs/critters
- Add
@nuxtjs/crittersto themodulessection ofnuxt.config.js
{
modules: [
'@nuxtjs/critters',
],
}
How it works
Nuxt has a number of ways to optimize your CSS in production:
- ✅ Nuxt uses
cssnanoin the build step to minify CSS rules - 📦 You can enable
purgecssto remove unused CSS rules from your bundle. - ✅ with
@nuxtjs/crittersyou can now extract CSS files and load them separately, just inlining the CSS necessary to render the page.
Options
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 beasties: https://github.com/danielroe/beasties#beasties-
config: {
// Default: 'media'
preload: 'swap',
},
},
})
Development
- Clone this repository
- Enable corepack with
corepack enable - Install dependencies using
pnpm install - Start development server using
pnpm dev
License
<!-- Badges -->Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
