From d589bc5819b68ff90fdd6bd467d31ca0fded0b56 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 18 Aug 2017 17:16:03 +0430 Subject: [PATCH 1/2] static ~> ssr-only --- bin/nuxt-build | 8 ++++---- bin/nuxt-dev | 10 +++++----- bin/nuxt-generate | 6 +++--- bin/nuxt-start | 10 +++++----- lib/common/options.js | 2 +- lib/core/renderer.js | 6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bin/nuxt-build b/bin/nuxt-build index c079293bfb..eb567ebc13 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -31,10 +31,10 @@ if (argv.help) { Usage $ nuxt build Options - --analyze, -a Launch webpack-bundle-analyzer to optimize your bundles. - --mode, -m [spa|universal|static] Nuxt Mode (default: universal) - --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) - --help, -h Displays this message + --analyze, -a Launch webpack-bundle-analyzer to optimize your bundles. + --mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal) + --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) + --help, -h Displays this message `) process.exit(0) } diff --git a/bin/nuxt-dev b/bin/nuxt-dev index 32e6ce498f..5d680140dc 100755 --- a/bin/nuxt-dev +++ b/bin/nuxt-dev @@ -40,11 +40,11 @@ if (argv.help) { Usage $ nuxt dev -p -H Options - --port, -p A port number on which to start the application - --hostname, -H Hostname on which to start the application - --mode, -m [spa|universal|static] Nuxt Mode (default: universal) - --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) - --help, -h Displays this message + --port, -p A port number on which to start the application + --hostname, -H Hostname on which to start the application + --mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal) + --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) + --help, -h Displays this message `) process.exit(0) } diff --git a/bin/nuxt-generate b/bin/nuxt-generate index e24cecb349..5f549abd0c 100755 --- a/bin/nuxt-generate +++ b/bin/nuxt-generate @@ -30,9 +30,9 @@ if (argv.help) { Usage $ nuxt generate Options - --mode, -m [spa|universal|static] Nuxt Mode (default: universal) - --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) - --help, -h Displays this message + --mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal) + --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) + --help, -h Displays this message `) process.exit(0) } diff --git a/bin/nuxt-start b/bin/nuxt-start index 95bfdef4da..391cb3765e 100755 --- a/bin/nuxt-start +++ b/bin/nuxt-start @@ -33,11 +33,11 @@ if (argv.help) { Usage $ nuxt start -p -H Options - --port, -p A port number on which to start the application - --hostname, -H Hostname on which to start the application - --mode, -m [spa|universal|static] Nuxt Mode (default: universal) - --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) - --help, -h Displays this message + --port, -p A port number on which to start the application + --hostname, -H Hostname on which to start the application + --mode, -m [spa|universal|ssr-only] Nuxt Mode (default: universal) + --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) + --help, -h Displays this message `) process.exit(0) } diff --git a/lib/common/options.js b/lib/common/options.js index e2bd42bf90..a1dcbf4a62 100755 --- a/lib/common/options.js +++ b/lib/common/options.js @@ -158,7 +158,7 @@ Options.modes = { ssr: true }, render: { - ssr: 'static' + ssr: 'only' } } } diff --git a/lib/core/renderer.js b/lib/core/renderer.js index a1420d0953..4604271d65 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -116,8 +116,8 @@ export default class Renderer extends Tapable { return this.options.render.ssr === false } - get staticSSR () { - return this.options.render.ssr === 'static' + get onlySSR () { + return this.options.render.ssr === 'only' } get isReady () { @@ -455,7 +455,7 @@ export default class Renderer extends Tapable { let resourceHints = '' - if (!this.staticSSR) { + if (!this.onlySSR) { if (this.options.render.resourceHints) { resourceHints = context.renderResourceHints() HEAD += resourceHints From 2c1473c2330410ca558bc7514d1c5ab485638cce Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 18 Aug 2017 17:36:46 +0430 Subject: [PATCH 2/2] disable minify on build generate --- bin/nuxt-build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/nuxt-build b/bin/nuxt-build index eb567ebc13..dc0a23fdee 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -74,8 +74,10 @@ builder.build() .then(() => { debug('Building done') if (options.mode === 'spa') { - // Generate on spa mode - return new Generator(nuxt, builder).generate({ build: false }).then(() => { + // Disable minify to get exact results of nuxt start + nuxt.options.generate.minify = false + // Generate on SPA mode + return new Generator(nuxt, builder).generate({ build: false, minify: false }).then(() => { if (!nuxt.options.dev) { // eslint-disable-next-line no-console console.log(`✓ You can now directly upload ${nuxt.options.generate.dir}/ or start server using "nuxt start"`)