diff --git a/README.md b/README.md
index 1966077196..19b4648111 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,11 @@
-
+
+
+
+
+
@@ -169,8 +173,74 @@ Note: we recommend putting `.nuxt` in `.npmignore` or `.gitignore`.
https://github.com/nuxt/nuxt.js/projects/1
-## Donate
+## Backers
-Feel free to make a donation to support us.
+Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/nuxtjs#backer)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Sponsors
+
+Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/nuxtjs#sponsor)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/examples/vue-apollo/nuxt.config.js b/examples/vue-apollo/nuxt.config.js
index 1ea10b9c69..f73ea6eaf6 100644
--- a/examples/vue-apollo/nuxt.config.js
+++ b/examples/vue-apollo/nuxt.config.js
@@ -6,7 +6,7 @@ module.exports = {
middleware: 'apollo'
},
plugins: [
- // Will inject the plugin in the $root app and also in the context as `i18n`
+ // Will inject the plugin in the $root app and also in the context as `apolloProvider`
{ src: '~plugins/apollo.js', injectAs: 'apolloProvider' }
]
}
diff --git a/examples/with-vuetify/README.md b/examples/with-vuetify/README.md
index 74d55b8ae2..4f7f4638a4 100644
--- a/examples/with-vuetify/README.md
+++ b/examples/with-vuetify/README.md
@@ -1,4 +1,8 @@
# Using Vuetify.js with Nuxt.js
+## Demo
+https://nuxt-with-vuetify-example.surge.sh
+
+## Resources
https://nuxtjs.org/examples/with-vuetify
https://vuetifyjs.com/
diff --git a/examples/with-vuetify/css/app.styl b/examples/with-vuetify/css/app.styl
index 0b24ada921..cd1c8f9dc8 100644
--- a/examples/with-vuetify/css/app.styl
+++ b/examples/with-vuetify/css/app.styl
@@ -1 +1,2 @@
+@require './vendor/material-icons.styl'
@require './vendor/vuetify.styl'
diff --git a/examples/with-vuetify/css/vendor/material-icons.styl b/examples/with-vuetify/css/vendor/material-icons.styl
new file mode 100644
index 0000000000..a063664368
--- /dev/null
+++ b/examples/with-vuetify/css/vendor/material-icons.styl
@@ -0,0 +1,21 @@
+@font-face {
+ font-family: 'Material Icons';
+ font-style: normal;
+ font-weight: 400;
+ src: local('Material Icons'), local('MaterialIcons-Regular'), url(https://fonts.gstatic.com/s/materialicons/v22/2fcrYFNaTjcS6g4U3t-Y5UEw0lE80llgEseQY3FEmqw.woff2) format('woff2');
+}
+.material-icons {
+ font-family: 'Material Icons';
+ font-weight: normal;
+ font-style: normal;
+ font-size: 24px;
+ line-height: 1;
+ letter-spacing: normal;
+ text-transform: none;
+ display: inline-block;
+ white-space: nowrap;
+ word-wrap: normal;
+ direction: ltr;
+ -webkit-font-feature-settings: 'liga';
+ -webkit-font-smoothing: antialiased;
+}
diff --git a/examples/with-vuetify/nuxt.config.js b/examples/with-vuetify/nuxt.config.js
index 9edc6811ef..a01ebf437d 100644
--- a/examples/with-vuetify/nuxt.config.js
+++ b/examples/with-vuetify/nuxt.config.js
@@ -11,8 +11,7 @@ module.exports = {
],
head: {
link: [
- { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto' },
- { rel: 'stylesheet', href: 'https://fonts.googleapis.com/icon?family=Material+Icons' }
+ { rel: 'preload', as: 'style', href: 'https://fonts.googleapis.com/css?family=Roboto' }
]
}
}
diff --git a/examples/with-vuetify/package.json b/examples/with-vuetify/package.json
index f32f783ecb..baa308ca69 100644
--- a/examples/with-vuetify/package.json
+++ b/examples/with-vuetify/package.json
@@ -1,13 +1,16 @@
{
"name": "with-vuetify",
"dependencies": {
- "nuxt": "0.10",
- "vuetify": "0.9.4"
+ "nuxt": "^0.10.7",
+ "vuetify": "^0.11.1"
},
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
- "start": "nuxt start"
+ "start": "nuxt start",
+ "generate": "nuxt generate",
+ "predeploy": "yarn run generate",
+ "deploy": "surge --domain nuxt-with-vuetify-example.surge.sh dist"
},
"devDependencies": {
"stylus": "^0.54.5",
diff --git a/lib/app/router.js b/lib/app/router.js
index 4d3dc71f64..735b6cf2ec 100644
--- a/lib/app/router.js
+++ b/lib/app/router.js
@@ -58,6 +58,7 @@ export function createRouter () {
mode: '<%= router.mode %>',
base: '<%= router.base %>',
linkActiveClass: '<%= router.linkActiveClass %>',
+ linkExactActiveClass: '<%= router.linkExactActiveClass %>',
scrollBehavior,
routes: [
<%= _routes %>
diff --git a/lib/generate.js b/lib/generate.js
index d1efb299aa..3a930de3bc 100644
--- a/lib/generate.js
+++ b/lib/generate.js
@@ -1,7 +1,6 @@
'use strict'
import fs from 'fs-extra'
-import co from 'co'
import pify from 'pify'
import _ from 'lodash'
import { resolve, join, dirname, sep } from 'path'
@@ -39,7 +38,7 @@ const defaults = {
}
}
-export default function () {
+export default async function () {
const s = Date.now()
let errors = []
/*
@@ -51,100 +50,83 @@ export default function () {
var srcBuiltPath = resolve(this.dir, '.nuxt', 'dist')
var distPath = resolve(this.dir, this.options.generate.dir)
var distNuxtPath = join(distPath, (isUrl(this.options.build.publicPath) ? '' : this.options.build.publicPath))
- return co(function * () {
- /*
- ** Launch build process
- */
- yield self.build()
- /*
- ** Clean destination folder
- */
- try {
- yield remove(distPath)
- debug('Destination folder cleaned')
- } catch (e) {}
- /*
- ** Copy static and built files
- */
- if (fs.existsSync(srcStaticPath)) {
- yield copy(srcStaticPath, distPath)
- }
- yield copy(srcBuiltPath, distNuxtPath)
- debug('Static & build files copied')
- })
- .then(() => {
+ /*
+ ** Launch build process
+ */
+ await self.build()
+ /*
+ ** Clean destination folder
+ */
+ try {
+ await remove(distPath)
+ debug('Destination folder cleaned')
+ } catch (e) {}
+ /*
+ ** Copy static and built files
+ */
+ if (fs.existsSync(srcStaticPath)) {
+ await copy(srcStaticPath, distPath)
+ }
+ await copy(srcBuiltPath, distNuxtPath)
+ debug('Static & build files copied')
// Resolve config.generate.routes promises before generating the routes
- return promisifyRoute(this.options.generate.routes || [])
- .catch((e) => {
- console.error('Could not resolve routes') // eslint-disable-line no-console
- console.error(e) // eslint-disable-line no-console
- process.exit(1)
- throw e // eslint-disable-line no-unreachable
- })
- })
- .then((generateRoutes) => {
- /*
- ** Generate html files from routes
- */
- generateRoutes.forEach((route) => {
- if (this.routes.indexOf(route) < 0) {
- this.routes.push(route)
- }
- })
- let routes = this.routes
- return co(function * () {
- while (routes.length) {
- let n = 0
- yield routes.splice(0, 500).map((route) => {
- return co(function * () {
- yield waitFor(n++ * self.options.generate.interval)
- try {
- var { html, error } = yield self.renderRoute(route, { _generate: true })
- if (error) {
- errors.push({ type: 'handled', route, error })
- }
- } catch (err) {
- errors.push({ type: 'unhandled', route, error: err })
- return
- }
- try {
- var minifiedHtml = minify(html, self.options.generate.minify)
- } catch (err) {
- let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`)
- errors.push({ type: 'unhandled', route, error: minifyErr })
- return
- }
- var path = join(route, sep, 'index.html') // /about -> /about/index.html
- debug('Generate file: ' + path)
- path = join(distPath, path)
- // Make sure the sub folders are created
- yield mkdirp(dirname(path))
- yield writeFile(path, minifiedHtml, 'utf8')
- })
- })
- }
- })
- })
- .then((pages) => {
- // Add .nojekyll file to let Github Pages add the _nuxt/ folder
- // https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/
- const nojekyllPath = resolve(distPath, '.nojekyll')
- return writeFile(nojekyllPath, '')
- })
- .then(() => {
- const duration = Math.round((Date.now() - s) / 100) / 10
- debug(`HTML Files generated in ${duration}s`)
-
- if (errors.length) {
- const report = errors.map(({ type, route, error }) => {
- if (type === 'unhandled') {
- return `Route: '${route}'\n${error.stack}`
- } else {
- return `Route: '${route}' thrown an error: \n` + JSON.stringify(error)
- }
- })
- console.error('==== Error report ==== \n' + report).join('\n\n') // eslint-disable-line no-console
+ try {
+ var generateRoutes = await promisifyRoute(this.options.generate.routes || [])
+ } catch (e) {
+ console.error('Could not resolve routes') // eslint-disable-line no-console
+ console.error(e) // eslint-disable-line no-console
+ process.exit(1)
+ throw e // eslint-disable-line no-unreachable
+ }
+ /*
+ ** Generate html files from routes
+ */
+ generateRoutes.forEach((route) => {
+ if (this.routes.indexOf(route) < 0) {
+ this.routes.push(route)
}
- return this
})
+ let n = 0
+ for (let route of this.routes) {
+ await waitFor(n++ * self.options.generate.interval)
+ try {
+ var { html, error } = await self.renderRoute(route, { _generate: true })
+ if (error) {
+ errors.push({ type: 'handled', route, error })
+ }
+ } catch (err) {
+ errors.push({ type: 'unhandled', route, error: err })
+ continue
+ }
+ try {
+ var minifiedHtml = minify(html, self.options.generate.minify)
+ } catch (err) {
+ let minifyErr = new Error(`HTML minification failed. Make sure the route generates valid HTML. Failed HTML:\n ${html}`)
+ errors.push({ type: 'unhandled', route, error: minifyErr })
+ continue
+ }
+ var path = join(route, sep, 'index.html') // /about -> /about/index.html
+ debug('Generate file: ' + path)
+ path = join(distPath, path)
+ // Make sure the sub folders are created
+ await mkdirp(dirname(path))
+ await writeFile(path, minifiedHtml, 'utf8')
+ }
+ // Add .nojekyll file to let Github Pages add the _nuxt/ folder
+ // https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/
+ const nojekyllPath = resolve(distPath, '.nojekyll')
+ writeFile(nojekyllPath, '')
+ const duration = Math.round((Date.now() - s) / 100) / 10
+ debug(`HTML Files generated in ${duration}s`)
+
+ if (errors.length) {
+ const report = errors.map(({ type, route, error }) => {
+ if (type === 'unhandled') {
+ return `Route: '${route}'\n${error.stack}`
+ } else {
+ return `Route: '${route}' thrown an error: \n` + JSON.stringify(error)
+ }
+ })
+ console.error('==== Error report ==== \n' + report.join('\n\n')) // eslint-disable-line no-console
+ }
}
diff --git a/lib/nuxt.js b/lib/nuxt.js
index 798941a0de..9e4f1f4eee 100644
--- a/lib/nuxt.js
+++ b/lib/nuxt.js
@@ -37,6 +37,7 @@ class Nuxt {
base: '/',
middleware: [],
linkActiveClass: 'nuxt-link-active',
+ linkExactActiveClass: 'nuxt-link-exact-active',
extendRoutes: null,
scrollBehavior: null
},
diff --git a/lib/webpack/helpers.js b/lib/webpack/helpers.js
index 3b67924213..e3fae8288e 100755
--- a/lib/webpack/helpers.js
+++ b/lib/webpack/helpers.js
@@ -7,9 +7,9 @@ export function extractStyles () {
export function styleLoader (ext, loader = []) {
if (extractStyles.call(this)) {
return ExtractTextPlugin.extract({
- use: ['css-loader?minimize'].concat(loader),
- fallback: 'vue-style-loader'
+ use: ['css-loader?minify&sourceMap'].concat(loader),
+ fallback: 'vue-style-loader?sourceMap'
})
}
- return ['vue-style-loader', 'css-loader'].concat(loader)
+ return ['vue-style-loader?sourceMap', 'css-loader?sourceMap'].concat(loader)
}
diff --git a/lib/webpack/vue-loader.config.js b/lib/webpack/vue-loader.config.js
index 094ce139c8..9dc590107d 100644
--- a/lib/webpack/vue-loader.config.js
+++ b/lib/webpack/vue-loader.config.js
@@ -18,7 +18,7 @@ export default function ({ isClient }) {
'css': styleLoader.call(this, 'css'),
'less': styleLoader.call(this, 'less', 'less-loader'),
'sass': styleLoader.call(this, 'sass', 'sass-loader?indentedSyntax'),
- 'scss': styleLoader.call(this, 'sass', 'scss-loader'),
+ 'scss': styleLoader.call(this, 'sass', 'sass-loader?sourceMap'),
'stylus': styleLoader.call(this, 'stylus', 'stylus-loader'),
'styl': styleLoader.call(this, 'stylus', 'stylus-loader')
},
diff --git a/package.json b/package.json
index a1276b865f..1320758da4 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,8 @@
"build": "webpack",
"watch": "webpack --watch",
"precommit": "npm run lint",
- "prepublish": "npm run build"
+ "prepublish": "npm run build",
+ "postinstall": "opencollective postinstall"
},
"engines": {
"node": ">=4.3.0 <5.0.0 || >=5.10",
@@ -74,6 +75,7 @@
"lru-cache": "^4.0.2",
"memory-fs": "^0.4.1",
"offline-plugin": "^4.7.0",
+ "opencollective": "^1.0.3",
"pify": "^2.3.0",
"post-compile-webpack-plugin": "^0.1.1",
"preload-webpack-plugin": "^1.2.2",
@@ -118,5 +120,10 @@
"request": "^2.81.0",
"request-promise-native": "^1.0.3",
"webpack-node-externals": "^1.5.4"
+ },
+ "collective": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/nuxtjs",
+ "logo": "https://opencollective.com/nuxtjs/logo.txt?reverse=true&variant=variant2"
}
-}
+}
\ No newline at end of file