Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a57c9f6

Browse files
authored
Copy static folder (vuejs#328)
* copy static folder * add doc
1 parent 8b1b918 commit a57c9f6

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

bin/vue-build

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var PostCompilePlugin = require('post-compile-webpack-plugin')
1414
var ProgressPlugin = require('webpack/lib/ProgressPlugin')
1515
var ExtractTextPlugin = require('extract-text-webpack-plugin')
1616
var isYarn = require('installed-by-yarn-globally')
17+
var CopyPlugin = require('copy-webpack-plugin')
1718
var tildify = require('tildify')
1819
var loaders = require('../lib/loaders')
1920
var logger = require('../lib/logger')
@@ -196,6 +197,14 @@ var webpackConfig = {
196197
]
197198
}
198199

200+
// copy ./static/** to dist folder
201+
if (fs.existsSync('static')) {
202+
webpackConfig.plugins.push(new CopyPlugin([{
203+
from: 'static',
204+
to: './'
205+
}]))
206+
}
207+
199208
// if entry ends with `.vue` and no `mount` option was specified
200209
// we implicitly set `mount` to true unless `lib` is set
201210
// for `.js` component you can set `mount` to true manually

docs/build.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,7 @@ By default we only use a single babel preset: [babel-preset-vue-app](https://git
238238
- Transform Vue JSX
239239

240240
You can populate a `.babelrc` in project root directory to override it.
241+
242+
### Copy static files
243+
244+
Everything in `./static` folder will be copied to dist folder, for example: `static/favicon.ico` will be copied to `dist/favicon.ico`.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"commander": "^2.9.0",
4242
"connect-history-api-fallback": "^1.3.0",
4343
"consolidate": "^0.14.0",
44+
"copy-webpack-plugin": "^4.0.1",
4445
"css-loader": "^0.26.1",
4546
"download-git-repo": "^0.2.1",
4647
"express": "^4.14.0",

yarn.lock

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,10 @@ block-stream@*:
876876
dependencies:
877877
inherits "~2.0.0"
878878

879+
bluebird@^2.10.2:
880+
version "2.11.0"
881+
resolved "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
882+
879883
bluebird@^3.0.5, bluebird@^3.1.1, bluebird@^3.4.7:
880884
version "3.4.7"
881885
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3"
@@ -1327,6 +1331,19 @@ [email protected]:
13271331
version "0.3.1"
13281332
resolved "http://registry.npm.taobao.org/cookie/download/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
13291333

1334+
copy-webpack-plugin@^4.0.1:
1335+
version "4.0.1"
1336+
resolved "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.0.1.tgz#9728e383b94316050d0c7463958f2b85c0aa8200"
1337+
dependencies:
1338+
bluebird "^2.10.2"
1339+
fs-extra "^0.26.4"
1340+
glob "^6.0.4"
1341+
is-glob "^3.1.0"
1342+
loader-utils "^0.2.15"
1343+
lodash "^4.3.0"
1344+
minimatch "^3.0.0"
1345+
node-dir "^0.1.10"
1346+
13301347
core-js@^2.4.0:
13311348
version "2.4.1"
13321349
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
@@ -2284,7 +2301,7 @@ friendly-errors-webpack-plugin@^1.1.2:
22842301
chalk "^1.1.3"
22852302
error-stack-parser "^1.3.6"
22862303

2287-
fs-extra@~0.26.5:
2304+
fs-extra@^0.26.4, fs-extra@~0.26.5:
22882305
version "0.26.7"
22892306
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9"
22902307
dependencies:
@@ -2431,6 +2448,16 @@ glob@^5.0.3:
24312448
once "^1.3.0"
24322449
path-is-absolute "^1.0.0"
24332450

2451+
glob@^6.0.4:
2452+
version "6.0.4"
2453+
resolved "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
2454+
dependencies:
2455+
inflight "^1.0.4"
2456+
inherits "2"
2457+
minimatch "2 || 3"
2458+
once "^1.3.0"
2459+
path-is-absolute "^1.0.0"
2460+
24342461
glob@^7.0.3, glob@^7.0.5:
24352462
version "7.1.1"
24362463
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
@@ -3174,7 +3201,7 @@ loader-runner@^2.2.0:
31743201
version "2.2.0"
31753202
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.2.0.tgz#824c1b699c4e7a2b6501b85902d5b862bf45b3fa"
31763203

3177-
[email protected], loader-utils@^0.2.10, loader-utils@^0.2.11, loader-utils@^0.2.16, loader-utils@^0.2.3, loader-utils@^0.2.7, loader-utils@~0.2.2, loader-utils@~0.2.5:
3204+
[email protected], loader-utils@^0.2.10, loader-utils@^0.2.11, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.3, loader-utils@^0.2.7, loader-utils@~0.2.2, loader-utils@~0.2.5:
31783205
version "0.2.16"
31793206
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d"
31803207
dependencies:
@@ -3546,6 +3573,12 @@ no-case@^2.2.0:
35463573
dependencies:
35473574
lower-case "^1.1.1"
35483575

3576+
node-dir@^0.1.10:
3577+
version "0.1.16"
3578+
resolved "https://registry.npmjs.org/node-dir/-/node-dir-0.1.16.tgz#d2ef583aa50b90d93db8cdd26fcea58353957fe4"
3579+
dependencies:
3580+
minimatch "^3.0.2"
3581+
35493582
node-libs-browser@^2.0.0:
35503583
version "2.0.0"
35513584
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.0.0.tgz#a3a59ec97024985b46e958379646f96c4b616646"

0 commit comments

Comments
 (0)