JavaScript HTML Vue
Permalink
Failed to load latest commit information.
.circleci fix circleci Mar 27, 2018
.github Update CMTY url Jun 4, 2018
benchmarks add: Add benchmarks Oct 28, 2017
bin fix(builder): `nuxt build -a` omits webpack-bundle-analyzer options d… Jun 6, 2018
examples add with-vuikit example Apr 21, 2018
lib chore: remove to-do which has been done Jun 13, 2018
scripts fix(rollup): fix build warnings Jun 1, 2018
start misc: improve coverage and packaging (#3121) Mar 27, 2018
test test: refactor cli tests (#3357) Jun 6, 2018
.babelrc misc: improve coverage and packaging (#3121) Mar 27, 2018
.editorconfig Add editorconfig Dec 15, 2016
.eslintignore refactor: enable lint in storybook Mar 21, 2018
.eslintrc.js add jest Mar 18, 2018
.gitignore chore: git ignore yarn-error.log (#3413) Jun 6, 2018
.npmrc use yarnpkg registry Sep 24, 2017
.travis.yml perf: remove rollup build Dec 12, 2017
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Oct 20, 2017
CONTRIBUTING.md updated README with 'npm run' info in nuxt app example Mar 19, 2018
LICENSE.md Update LICENSE.md Feb 23, 2017
README.md fix: small typo in README.md, application => applications (#3426) Jun 9, 2018
appveyor.yml chore(ci): temporary disable appveyor tests for node 10.x due to yarn… Jun 1, 2018
index.js feat: auto fallback to legacy build for node@6 support Jun 1, 2018
jest.config.js fix: expand is cli option rather than configuration Apr 8, 2018
package.json chore: add detectOpenHandles for tracking down more jest exist details Jun 13, 2018
yarn.lock feat: use postcss-preset-env instead of postcss-cssnext (#3291) Jun 1, 2018

README.md

Build Status Build Status Windows Build Status  Coverage Status Downloads Version License Gitter

Support us

Vue.js Meta Framework to create complex, fast & universal web applications quickly.

Links

Features

  • Automatic transpilation and bundling (with webpack and babel)
  • Hot code reloading
  • Server-side rendering OR Single Page App OR Static Generated, you choose 🔥
  • Static file serving. ./static/ is mapped to /
  • Configurable with a nuxt.config.js file
  • Custom layouts with the layouts/ directory
  • Middleware
  • Code splitting for every pages/

Learn more at nuxtjs.org.

Partners

Become a partner and get your logo on our README on Github and every page of https://nuxtjs.org website with a link to your site. [Become a partner]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Getting started

$ npm install nuxt

Add a script to your package.json like this:

{
  "scripts": {
    "start": "nuxt"
  }
}

After that, the file-system is the main API. Every .vue file becomes a route that gets automatically processed and rendered.

Populate ./pages/index.vue inside your project:

<template>
  <h1>Hello {{ name }}!</h1>
</template>

<script>
export default {
  data: () => {
    return { name: 'world' }
  }
}
</script>

And then run:

npm start

Go to http://localhost:3000

Templates

👉 We recommend to start directly with our cli create-nuxt-app for the latest updates.

Or you can start by using one of our starter templates:

  • starter: Basic Nuxt.js project template
  • express: Nuxt.js + Express
  • koa: Nuxt.js + Koa
  • adonuxt: Nuxt.js + AdonisJS
  • micro: Nuxt.js + Micro
  • nuxtent: Nuxt.js + Nuxtent module for content heavy sites

Using nuxt.js programmatically

const { Nuxt, Builder } = require('nuxt')

// Import and set nuxt.js options
let config = require('./nuxt.config.js')
config.dev = (process.env.NODE_ENV !== 'production')

let nuxt = new Nuxt(config)

// Start build process (only in development)
if (config.dev) {
  new Builder(nuxt).build()
}

// You can use nuxt.render(req, res) or nuxt.renderRoute(route, context)

Learn more: https://nuxtjs.org/api/nuxt

Using nuxt.js as a middleware

You might want to use your own server with your configurations, your API and everything awesome your created with. That's why you can use nuxt.js as a middleware. It's recommended to use it at the end of your middleware since it will handle the rendering of your web application and won't call next().

app.use(nuxt.render)

Learn more: https://nuxtjs.org/api/nuxt-render

Render a specific route

This is mostly used for nuxt generate and test purposes but you might find another utility!

nuxt.renderRoute('/about', context)
.then(function ({ html, error }) {
  // You can check error to know if your app displayed the error page for this route
  // Useful to set the correct status code if an error appended:
  if (error) {
    return res.status(error.statusCode || 500).send(html)
  }
  res.send(html)
})
.catch(function (error) {
  // And error appended while rendering the route
})

Learn more: https://nuxtjs.org/api/nuxt-render-route

Examples

Please take a look at https://nuxtjs.org/examples or directly in https://github.com/nuxt/nuxt.js/tree/dev/examples.

Production deployment

To deploy, instead of running nuxt, you probably want to build ahead of time. Therefore, building and starting are separate commands:

nuxt build
nuxt start

For example, to deploy with now a package.json like follows is recommended:

{
  "name": "my-app",
  "dependencies": {
    "nuxt": "latest"
  },
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start"
  }
}

Then run now and enjoy!

Note: we recommend putting .nuxt in .npmignore or .gitignore.

Core team

Sebastien Chopin Alexandre Chopin Pooya Parsa Clark Du
Atinux alexchopin pi0 clarkdo

Contributors

Thank you to all our contributors!

Contributing

Please see our CONTRIBUTING.md

Roadmap

https://trello.com/b/lgy93IOl/nuxtjs-10

License

MIT