Skip to content

Commit

Permalink
Replaced “favicon” feature with a more generic “copy”
Browse files Browse the repository at this point in the history
Allows supplying array of paths / patterns to copy to dist directory
  • Loading branch information
alexblunck committed Jan 11, 2019
1 parent 9a2e18f commit 091c733
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Add a `.webpackrc` file to the root of your project. Following options are defau
"host": "localhost",
"port": 3000,
"browser": "google chrome",
"favicon": null,
"copy": null,
"cssSourceMap": false,
"alias": null,
"zip": false,
Expand All @@ -55,11 +55,12 @@ Add a `.webpackrc` file to the root of your project. Following options are defau
- `framework` Javascript framework that is used: "vanilla", "react" or "ng1"
- `port` Port to start development server at
- `browser` Browser to open development server in
- `favicon` Relative path to favicon.ico to copy to `dist`
- `cssSourceMap` Enable css / scss source maps (Causes style flash on initial load when running development server)
- `alias` Create aliases to import or require certain modules more easily. See [Webpack Documentation](https://webpack.js.org/configuration/resolve/#resolve-alias) for more info
- `zip` If true create zip archive with build artifacts with following name: `PROJECT_NAME-GIT_COMMIT_HASH.zip`
- `bugsnagApiKey` If set upload source maps to bugsnag
- `copy` Array of patterns to copy to `dist`. See [Copy Webpack Plugin](https://github.com/webpack-contrib/copy-webpack-plugin#patterns) for more info

* `cssSourceMap` Enable css / scss source maps (Causes style flash on initial load when running development server)
* `alias` Create aliases to import or require certain modules more easily. See [Webpack Documentation](https://webpack.js.org/configuration/resolve/#resolve-alias) for more info
* `zip` If true create zip archive with build artifacts with following name: `PROJECT_NAME-GIT_COMMIT_HASH.zip`
* `bugsnagApiKey` If set upload source maps to bugsnag

## Scripts

Expand Down
4 changes: 2 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const userConfig = rc('webpack', {
host: 'localhost',
port: 3000,
browser: 'google chrome',
favicon: null,
copy: null,
cssSourceMap: false,
alias: null,
zip: false,
Expand All @@ -40,7 +40,7 @@ const options = {
host: userConfig.host,
port: userConfig.port,
browser: userConfig.browser,
favicon: userConfig.favicon,
copy: userConfig.copy,
cssSourceMap: userConfig.cssSourceMap,
alias: userConfig.alias,
zip: userConfig.zip,
Expand Down
16 changes: 16 additions & 0 deletions config/features/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Feature
* copy
*/

const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = function(options) {
if (!options.copy) {
return
}

return {
plugins: [new CopyWebpackPlugin(options.copy)]
}
}
22 changes: 0 additions & 22 deletions config/features/favicon.js

This file was deleted.

2 changes: 1 addition & 1 deletion config/features/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function(options) {
require('./svg')(options),
require('./files')(options),
require('./images')(options),
require('./favicon')(options),
require('./copy')(options),
require('./sourcemaps')(options),
require('./compress')(options),
require('./zip')(options),
Expand Down

0 comments on commit 091c733

Please sign in to comment.