Skip to content

Commit

Permalink
Features: Split media into files & images & optimize images
Browse files Browse the repository at this point in the history
- Deps: Added imagemin-webpack-plugin
  • Loading branch information
alexblunck committed Nov 23, 2017
1 parent 7b52d2d commit d7cc508
Show file tree
Hide file tree
Showing 5 changed files with 2,026 additions and 81 deletions.
4 changes: 2 additions & 2 deletions config/features/media.js → config/features/files.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Feature
* media
* files
*/

module.exports = function (options) {
return {
module: {
rules: [
{
test: /\.(png|gif|mp4)$/,
test: /\.(mp4)$/,
loader: require.resolve('file-loader'),
include: options.paths.src
}
Expand Down
23 changes: 23 additions & 0 deletions config/features/images.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Feature
* images
*/

const ImageminPlugin = require('imagemin-webpack-plugin').default

module.exports = function (options) {
return {
module: {
rules: [
{
test: /\.(png|gif|jpe?g)$/,
loader: require.resolve('file-loader'),
include: options.paths.src
}
]
},
plugins: [
new ImageminPlugin()
]
}
}
3 changes: 2 additions & 1 deletion config/features/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = function (options) {
require('./html')(options),
require('./sass')(options),
require('./svg')(options),
require('./media')(options),
require('./files')(options),
require('./images')(options),
require('./favicon')(options),
require('./sourcemaps')(options),
require('./minify')(options),
Expand Down
Loading

0 comments on commit d7cc508

Please sign in to comment.