nuxt-generate
Автор
Sébastien Chopin

Коммитер
Sébastien Chopin
9 лет назад 
Файлов изменено: 3
+11
–8
a8776de
.gitignore
+3
–0
@@ -7,3 +7,6 @@ | ||
# other | ||
.nuxt | ||
# dist example generation | ||
examples/**/dist |
lib/generate.js
+7
–7
@@ -5,7 +5,7 @@ | ||
const pify = require('pify') | ||
const debug = require('debug')('nuxt:generate') | ||
const _ = require('lodash') | ||
const { resolve, join } = require('path') | ||
const { resolve, join, dirname } = require('path') | ||
const copy = pify(fs.copy) | ||
const remove = pify(fs.remove) | ||
const writeFile = pify(fs.writeFile) | ||
@@ -24,7 +24,7 @@ | ||
var srcBuiltPath = resolve(this.dir, '.nuxt', 'dist') | ||
var distPath = resolve(this.dir, this.options.generate.dir) | ||
var distNuxtPath = resolve(distPath, '_nuxt') | ||
co(function * () { | ||
return co(function * () { | ||
/* | ||
** Clean destination folder | ||
*/ | ||
@@ -46,16 +46,16 @@ | ||
** Generate html files from routes | ||
*/ | ||
var promises = [] | ||
this.options.routes.forEach((route) => { | ||
this.routes.forEach((route) => { | ||
var promise = this.renderRoute(route.path) | ||
.then(({ html }) => { | ||
var path = route.path | ||
path += path[path.length - 1] === '/' ? 'index.html' : '.html' | ||
debug('Generate file : ' + path) | ||
var path = join(route.path, '/', 'index.html') // /about -> /about/index.html | ||
debug('Generate file: ' + path) | ||
path = join(distPath, path) | ||
// Make sure the sub folders are created | ||
fs.mkdirsSync(dirname(path)) | ||
return writeFile(path, html, 'utf8') | ||
}) | ||
console.log(promise) | ||
promises.push(promise) | ||
}) | ||
return Promise.all(promises) |
package.json
+1
–1
@@ -1,6 +1,6 @@ | ||
{ | ||
"name":"nuxt", | ||
"version":"0.3.1", | ||
"version":"0.3.2", | ||
"description":"A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", | ||
"main":"index.js", | ||
"license":"MIT", |
Cherry-pick
Команда cherry-pick позволяет выбрать отдельные коммиты из одной ветки и применить их к другой.