mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Merge branch 'dev' of github.com:Atinux/nuxt.js into dev
This commit is contained in:
commit
4c0db59587
11
README.md
11
README.md
@ -168,12 +168,19 @@ You can start by using one of our starter templates:
|
|||||||
## Using nuxt.js programmatically
|
## Using nuxt.js programmatically
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const Nuxt = require('nuxt')
|
const { Nuxt, Builder } = require('nuxt')
|
||||||
|
|
||||||
// Launch nuxt build with given options
|
// Import and set nuxt.js options
|
||||||
let config = require('./nuxt.config.js')
|
let config = require('./nuxt.config.js')
|
||||||
|
config.dev = !(process.env.NODE_ENV === 'production')
|
||||||
|
|
||||||
let nuxt = new Nuxt(config)
|
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)
|
// You can use nuxt.render(req, res) or nuxt.renderRoute(route, context)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user