From b3b77e61da40254b6d2726864b83701183015968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 30 Jul 2017 19:09:16 +0200 Subject: [PATCH] Update README.md --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44d7074586..39089af289 100644 --- a/README.md +++ b/README.md @@ -168,12 +168,19 @@ You can start by using one of our starter templates: ## Using nuxt.js programmatically ```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') +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) ```