apple-touch-icons-webpack-plugin
Version:
a webpack plugin for automatically creating apple touch icons and launch screens
51 lines (47 loc) • 1.58 kB
JavaScript
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpackMerge = require('webpack-merge');
const AppleTouchIconsPlugin = require("../src/index");
const modeConfig = env => require(`./build-utils/webpack.${env}`)(env);
module.exports = ({ mode }) =>
webpackMerge(
{
mode,
entry: './src/index.js',
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader'
},
{
test: /\.(jpeg|jpg|png|gif|svg)$/i,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
outputPath: 'assets/'
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'body',
minify: {
html5: true,
removeComments: true,
collapseWhitespace: true
}
}),
new CopyWebpackPlugin({
patterns: [{
from: 'src/assets/',
to: 'assets/'
}]
}),
new AppleTouchIconsPlugin()
]
},
modeConfig(mode)
);