diff --git a/docs/hello.md b/docs/hello.md index 71fcb798ad..f07b1a8fc8 100644 --- a/docs/hello.md +++ b/docs/hello.md @@ -3,4 +3,6 @@ id: hello title: Hello, World ! --- -Hi, Endilie here :) \ No newline at end of file +Hi, Endilie here :) + +![sakura](/img/sakura.png) \ No newline at end of file diff --git a/lib/commands/build.js b/lib/commands/build.js index abc9be7068..62d8f226d4 100644 --- a/lib/commands/build.js +++ b/lib/commands/build.js @@ -2,6 +2,8 @@ const webpackNiceLog = require('webpack-nicelog'); const webpack = require('webpack'); const path = require('path'); const chalk = require('chalk'); +const fs = require('fs-extra'); +const globby = require('globby'); const load = require('../load'); const createProdConfig = require('../webpack/prod'); @@ -51,6 +53,20 @@ module.exports = async function build(siteDir, cliOptions = {}) { await compile(config); const {outDir} = props; + + // copy static files + const staticDir = path.resolve(siteDir, 'static'); + const staticFiles = await globby(['**'], { + cwd: staticDir + }); + await Promise.all( + staticFiles.map(async source => { + const fromPath = path.resolve(staticDir, source); + const toPath = path.resolve(outDir, source); + return fs.copy(fromPath, toPath); + }) + ); + const relativeDir = path.relative(process.cwd(), outDir); console.log( `\n${chalk.green('Success!')} Generated static files in ${chalk.cyan(