mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-11 11:18:06 +00:00
Add transition hooks in nuxt.config.js
This commit is contained in:
parent
8f29fe6a54
commit
2d85b53266
@ -41,7 +41,7 @@ require('<%= pluginPath %>')
|
|||||||
// root instance
|
// root instance
|
||||||
// here we inject the router and store to all child components,
|
// here we inject the router and store to all child components,
|
||||||
// making them available everywhere as `this.$router` and `this.$store`.
|
// making them available everywhere as `this.$router` and `this.$store`.
|
||||||
const defaultTransition = <%= JSON.stringify(transition) %>
|
const defaultTransition = <%= serialize(transition) %>
|
||||||
const app = {
|
const app = {
|
||||||
router,
|
router,
|
||||||
<%= (store ? 'store,' : '') %>
|
<%= (store ? 'store,' : '') %>
|
||||||
|
@ -8,6 +8,7 @@ import fs from 'fs-extra'
|
|||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
import pify from 'pify'
|
import pify from 'pify'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
|
import serialize from 'serialize-javascript'
|
||||||
import { createBundleRenderer } from 'vue-server-renderer'
|
import { createBundleRenderer } from 'vue-server-renderer'
|
||||||
import { join, resolve, sep } from 'path'
|
import { join, resolve, sep } from 'path'
|
||||||
import clientWebpackConfig from './webpack/client.config.js'
|
import clientWebpackConfig from './webpack/client.config.js'
|
||||||
@ -199,7 +200,9 @@ function * generateRoutesAndFiles () {
|
|||||||
let moveTemplates = templatesFiles.map((file) => {
|
let moveTemplates = templatesFiles.map((file) => {
|
||||||
return readFile(r(__dirname, 'app', file), 'utf8')
|
return readFile(r(__dirname, 'app', file), 'utf8')
|
||||||
.then((fileContent) => {
|
.then((fileContent) => {
|
||||||
const template = _.template(fileContent)
|
const template = _.template(fileContent, {
|
||||||
|
imports: { serialize }
|
||||||
|
})
|
||||||
const content = template(templateVars)
|
const content = template(templateVars)
|
||||||
return writeFile(r(this.dir, '.nuxt', file), content, 'utf8')
|
return writeFile(r(this.dir, '.nuxt', file), content, 'utf8')
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user