blazeu / next-purgecss

nextjs + purgecss for faster websites 🔥

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

next-purgecss

  1. Install next-css and next-purgecss :
yarn install @zeit/next-css next-purgecss --dev

or

npm install @zeit/next-css next-purgecss --save-dev
  1. Next-css compiles your stylesheet to .next/static/style.css, so you need to include it in your page.
// ./pages/_document.js
import Document, { Head, Main, NextScript } from 'next/document'

export default class MyDocument extends Document {
  render() {
    return (
      <html>
        <Head>
          <link rel="stylesheet" href="/_next/static/style.css" />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </html>
    )
  }
}

More information : next-css.

  1. Edit next.config.js
// next.config.js
const withCss = require('@zeit/next-css')
const withPurgeCss = require('next-purgecss')

module.exports = withCss(withPurgeCss())

About

nextjs + purgecss for faster websites 🔥


Languages

Language:JavaScript 100.0%