Coder Social home page Coder Social logo

modern-next's Introduction

Next.js

This app shows how you can use extracted stylesheets for maximum performance in production.

Features:

  • Hot reloading in development without CSS-in-JS
  • 100% Page Speed score and 100% YSlow score (if put behind CDN)
  • Critical stylesheets injected per-device (phone, tablet, desktop)
  • SCSS and PostCSS with autoprefixing for styling
  • Content hashes for all resources for best integration with CDNs
  • Properly setup Cache headers for resources
  • Auto-bundling images referenced as url() in stylesheets
  • Auto-bundling of imported and required images
  • Inlining small images as Data URI (in both stylesheets and SSR page)
  • Properly handling multiple pages and routing between them
  • Ability to fallback to dynamic pages
  • Importing single icons from Font Awesome
  • GZip compression of served pages

How to use

Download the example or clone the repo:

curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-extracted-stylesheet
cd with-extracted-stylesheet

To get this example running you just need to

npm install
npm run dev

Visit http://localhost:3000 and try to modify styles/index.scss changing color. Your changes should be picked up instantly.

Deploying as static website

You should get complete webpage in out directory after running npm run build.

It is recommended to use node bin/start as a server though, to get dynamic content as fallback.

Deploying to now

Deploy it to the cloud with now (download) with:

now --npm

To deploy with critical CSS optimization (takes longer):

now --docker

Demo

You see this app and test with performance analytics tools under following address:

https://with-extracted-stylesheet.now.sh/

modern-next's People

Contributors

sheerun avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.