Skip to content

Commit

Permalink
OIL-108: optimized image minifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Awerkow-Schäfer, Dmitri committed Jun 20, 2018
1 parent f99082e commit 7c40f6e
Show file tree
Hide file tree
Showing 24 changed files with 281 additions and 240 deletions.
35 changes: 8 additions & 27 deletions etc/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ debugLog('Using following appConfig:', appConfig);
*/
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ImageminPlugin = require('imagemin-webpack-plugin').default;

/*
* Webpack Constants
Expand All @@ -27,10 +28,14 @@ const METADATA = {
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
var config = {
let config = {

bail: true,

performance: {
maxAssetSize: 1000000
},

/*
* The entry point for the bundle
* Our Angular.js app
Expand Down Expand Up @@ -115,30 +120,6 @@ var config = {
type: 'javascript/auto',
test: /\.json$/,
loader: 'json-loader'
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=image/svg+xml'
}, {
test: /\.png(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=image/png'
}, {
test: /\.jpeg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=image/png'
}, {
test: /\.jpg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=image/png'
}, {
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=application/font-woff'
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=application/font-woff'
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader?mimetype=application/octet-stream'
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
},
// https://github.com/jtangelder/sass-loader#usage
{
Expand Down Expand Up @@ -192,8 +173,8 @@ var config = {
     *
     * See: https://www.npmjs.com/package/copy-webpack-plugin
     */
new CopyWebpackPlugin(appConfig.copy)

new CopyWebpackPlugin(appConfig.copy),
new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i })
],

/*
Expand Down
29 changes: 0 additions & 29 deletions etc/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ const appConfig = helpers.getAppConfig();
const DefinePlugin = require('webpack/lib/DefinePlugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const WebpackMd5Hash = require('webpack-md5-hash');
// const ImageminPlugin = require('imagemin-webpack-plugin').default;
// const imageminMozjpeg = require('imagemin-mozjpeg');
// const imageminPngquant = require('imagemin-pngquant');
// const imageminSvgo = require('imagemin-svgo');
/**
* Webpack Constants
*/
Expand Down Expand Up @@ -95,31 +91,6 @@ const config = webpackMerge(commonConfig, {
*/
plugins: [

// /**
// * Plugin: ImageminPlugin
// * Description: Optimizes image assets
// *
// * This is a simple plugin that uses Imagemin to compress all images in your project.
// *
// * See: https://github.com/Klathmon/imagemin-webpack-plugin
// */
// new ImageminPlugin({
// test: /\.(jpe?g|png|gif|svg)$/i,
// plugins: [
// imageminMozjpeg({
// quality: 35,
// progressive: true
// }),
// imageminPngquant({
// quality: 10
// }),
// imageminSvgo()
// ],
// gifsicle: {
// optimizationLevel: 3
// }
// }),

/*
* Plugin: OccurenceOrderPlugin
* Description: Varies the distribution of the ids to get the smallest id length
Expand Down

0 comments on commit 7c40f6e

Please sign in to comment.