mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Lint
This commit is contained in:
parent
01b02a9010
commit
39db08c95b
@ -100,18 +100,18 @@ export default 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 })
|
||||
if (error) {
|
||||
errors.push({ type: 'handled', route, error })
|
||||
}
|
||||
} catch (err) {
|
||||
errors.push({ type : 'unhandled', route, error: err })
|
||||
errors.push({ type: 'unhandled', route, error: err })
|
||||
return
|
||||
}
|
||||
try {
|
||||
var minifiedHtml = minify(html, self.options.generate.minify)
|
||||
} catch(err) {
|
||||
} 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 })
|
||||
errors.push({ type: 'unhandled', route, error: minifyErr })
|
||||
return
|
||||
}
|
||||
var path = join(route, sep, 'index.html') // /about -> /about/index.html
|
||||
@ -136,13 +136,14 @@ export default function () {
|
||||
debug(`HTML Files generated in ${duration}s`)
|
||||
|
||||
if (errors.length) {
|
||||
console.error('==== Error report ==== \n' + errors.map( ({type, route, error}) => {
|
||||
if(type === 'unhandled') {
|
||||
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)
|
||||
}
|
||||
}).join('\n\n'))
|
||||
})
|
||||
console.error('==== Error report ==== \n' + report).join('\n\n') // eslint-disable-line no-console
|
||||
}
|
||||
return this
|
||||
})
|
||||
|
@ -1,10 +1,10 @@
|
||||
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
||||
|
||||
export function extractStyles(ext) {
|
||||
export function extractStyles (ext) {
|
||||
return !this.dev && !!this.options.build.extractCSS && this.options.build.extractCSS[ext] !== false
|
||||
}
|
||||
|
||||
export function styleLoader(ext, loader = []) {
|
||||
export function styleLoader (ext, loader = []) {
|
||||
if (!extractStyles.call(this, ext)) {
|
||||
return ['vue-style-loader', 'css-loader'].concat(loader)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user