Skip to content

Commit

Permalink
Copy static folder (vuejs#328)
Browse files Browse the repository at this point in the history
* copy static folder

* add doc
  • Loading branch information
egoist authored Feb 3, 2017
1 parent 8b1b918 commit a57c9f6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
9 changes: 9 additions & 0 deletions bin/vue-build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var PostCompilePlugin = require('post-compile-webpack-plugin')
var ProgressPlugin = require('webpack/lib/ProgressPlugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var isYarn = require('installed-by-yarn-globally')
var CopyPlugin = require('copy-webpack-plugin')
var tildify = require('tildify')
var loaders = require('../lib/loaders')
var logger = require('../lib/logger')
Expand Down Expand Up @@ -196,6 +197,14 @@ var webpackConfig = {
]
}

// copy ./static/** to dist folder
if (fs.existsSync('static')) {
webpackConfig.plugins.push(new CopyPlugin([{
from: 'static',
to: './'
}]))
}

// if entry ends with `.vue` and no `mount` option was specified
// we implicitly set `mount` to true unless `lib` is set
// for `.js` component you can set `mount` to true manually
Expand Down
4 changes: 4 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,7 @@ By default we only use a single babel preset: [babel-preset-vue-app](https://git
- Transform Vue JSX

You can populate a `.babelrc` in project root directory to override it.

### Copy static files

Everything in `./static` folder will be copied to dist folder, for example: `static/favicon.ico` will be copied to `dist/favicon.ico`.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"commander": "^2.9.0",
"connect-history-api-fallback": "^1.3.0",
"consolidate": "^0.14.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.26.1",
"download-git-repo": "^0.2.1",
"express": "^4.14.0",
Expand Down
37 changes: 35 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,10 @@ block-stream@*:
dependencies:
inherits "~2.0.0"

bluebird@^2.10.2:
version "2.11.0"
resolved "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"

bluebird@^3.0.5, bluebird@^3.1.1, bluebird@^3.4.7:
version "3.4.7"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3"
Expand Down Expand Up @@ -1327,6 +1331,19 @@ cookie@0.3.1:
version "0.3.1"
resolved "http://registry.npm.taobao.org/cookie/download/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"

copy-webpack-plugin@^4.0.1:
version "4.0.1"
resolved "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.0.1.tgz#9728e383b94316050d0c7463958f2b85c0aa8200"
dependencies:
bluebird "^2.10.2"
fs-extra "^0.26.4"
glob "^6.0.4"
is-glob "^3.1.0"
loader-utils "^0.2.15"
lodash "^4.3.0"
minimatch "^3.0.0"
node-dir "^0.1.10"

core-js@^2.4.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
Expand Down Expand Up @@ -2284,7 +2301,7 @@ friendly-errors-webpack-plugin@^1.1.2:
chalk "^1.1.3"
error-stack-parser "^1.3.6"

fs-extra@~0.26.5:
fs-extra@^0.26.4, fs-extra@~0.26.5:
version "0.26.7"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9"
dependencies:
Expand Down Expand Up @@ -2431,6 +2448,16 @@ glob@^5.0.3:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^6.0.4:
version "6.0.4"
resolved "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
dependencies:
inflight "^1.0.4"
inherits "2"
minimatch "2 || 3"
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.3, glob@^7.0.5:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
Expand Down Expand Up @@ -3174,7 +3201,7 @@ loader-runner@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.2.0.tgz#824c1b699c4e7a2b6501b85902d5b862bf45b3fa"

loader-utils@0.2.x, 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:
loader-utils@0.2.x, 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:
version "0.2.16"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d"
dependencies:
Expand Down Expand Up @@ -3546,6 +3573,12 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"

node-dir@^0.1.10:
version "0.1.16"
resolved "https://registry.npmjs.org/node-dir/-/node-dir-0.1.16.tgz#d2ef583aa50b90d93db8cdd26fcea58353957fe4"
dependencies:
minimatch "^3.0.2"

node-libs-browser@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.0.0.tgz#a3a59ec97024985b46e958379646f96c4b616646"
Expand Down

0 comments on commit a57c9f6

Please sign in to comment.