0.1.3 • Published 10 months ago

nuxt-style-extractor v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

nuxt-style-extractor

Extracts the style of the page as an external css when rendered on the server side

README 🦉

简体中文 | English

Motivation

Faster rendering and more readable seo

Features

  • 🚠  Optimal Caching
  •  Supports ssg, ssr and ssr with pre-rendering.
  • 🌲  Intelligent minification extraction, removing unused styles from the page, merging duplicate styles

Quick Setup

Install the module

npm i nuxt-style-extractor

Setup Module

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ["nuxt-style-extractor"],
});

That's all. Everything's automatic.

Configuration

Of course, you can also configure it.

// nuxt.config.ts
export default defineNuxtConfig({
  styleExtractor: {
    minify: true, // Whether to enable minification
    removeUnused: true, // Whether to remove unused styles
  },
});

Custom Transformer

// style-extractor.js
export default (options) => {
  return options.css + "body { background: red }";
};
// nuxt.config.ts
export default defineNuxtConfig({
  styleExtractor: {
    transformFile: "style-extractor.js",
  },
});
0.1.3

10 months ago

0.1.0

10 months ago

0.1.2

10 months ago

0.0.3

12 months ago

0.1.1

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.2

12 months ago