mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Merge branch 'master' of github.com:Atinux/nuxt.js
This commit is contained in:
commit
93e3fe800d
78
README.md
78
README.md
@ -7,7 +7,11 @@
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg" alt="Version"></a>
|
||||
<a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/l/nuxt.svg" alt="License"></a>
|
||||
<a href="https://gitter.im/nuxt/nuxt.js"><img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg" alt="Gitter"></a>
|
||||
<a href="https://donorbox.org/nuxt"><img src="https://img.shields.io/badge/Support%20us-donate-41B883.svg" alt="Support us"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/nuxtjs/backers/badge.svg" /></a>
|
||||
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/nuxtjs/sponsors/badge.svg" /></a>
|
||||
<a href="https://opencollective.com/nuxtjs"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
|
||||
</p>
|
||||
|
||||
@ -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)]
|
||||
|
||||
<a href="https://opencollective.com/nuxtjs/backer/0/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/1/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/2/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/3/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/4/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/5/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/6/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/7/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/8/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/9/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/10/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/11/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/12/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/13/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/14/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/15/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/16/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/17/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/18/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/19/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/20/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/21/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/22/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/23/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/24/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/25/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/26/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/27/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/28/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/backer/29/website" target="_blank"><img src="https://opencollective.com/nuxtjs/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## 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)]
|
||||
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/4/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/5/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/6/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/7/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/8/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/9/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/10/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/11/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/12/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/13/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/14/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/15/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/16/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/17/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/18/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/19/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/20/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/21/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/22/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/23/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/24/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/25/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/26/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/27/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/28/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nuxtjs/sponsor/29/website" target="_blank"><img src="https://opencollective.com/nuxtjs/sponsor/29/avatar.svg"></a>
|
||||
|
||||
<a href="https://donorbox.org/nuxt"><img src="https://img.shields.io/badge/Support%20us-donate-41B883.svg" alt="Support us"></a>
|
||||
|
@ -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' }
|
||||
]
|
||||
}
|
||||
|
@ -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<br>
|
||||
https://vuetifyjs.com/
|
||||
|
@ -1 +1,2 @@
|
||||
@require './vendor/material-icons.styl'
|
||||
@require './vendor/vuetify.styl'
|
||||
|
21
examples/with-vuetify/css/vendor/material-icons.styl
vendored
Normal file
21
examples/with-vuetify/css/vendor/material-icons.styl
vendored
Normal file
@ -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;
|
||||
}
|
@ -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' }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -58,6 +58,7 @@ export function createRouter () {
|
||||
mode: '<%= router.mode %>',
|
||||
base: '<%= router.base %>',
|
||||
linkActiveClass: '<%= router.linkActiveClass %>',
|
||||
linkExactActiveClass: '<%= router.linkExactActiveClass %>',
|
||||
scrollBehavior,
|
||||
routes: [
|
||||
<%= _routes %>
|
||||
|
172
lib/generate.js
172
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
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ class Nuxt {
|
||||
base: '/',
|
||||
middleware: [],
|
||||
linkActiveClass: 'nuxt-link-active',
|
||||
linkExactActiveClass: 'nuxt-link-exact-active',
|
||||
extendRoutes: null,
|
||||
scrollBehavior: null
|
||||
},
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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')
|
||||
},
|
||||
|
11
package.json
11
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"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user