feat(webpack): fix styling issues

pull/2670/head
Chaim Lev-Ari 2018-10-28 10:06:43 +02:00
parent 61d33383b3
commit 86bb816cf1
2 changed files with 45 additions and 19 deletions

View File

@ -18,10 +18,9 @@
<link rel="apple-touch-icon" sizes="180x180" href="${require('../assets/ico/apple-touch-icon.png')}"> <link rel="apple-touch-icon" sizes="180x180" href="${require('../assets/ico/apple-touch-icon.png')}">
<link rel="icon" type="image/png" sizes="32x32" href="${require('../assets/ico/favicon-32x32.png')}"> <link rel="icon" type="image/png" sizes="32x32" href="${require('../assets/ico/favicon-32x32.png')}">
<link rel="icon" type="image/png" sizes="16x16" href="${require('../assets/ico/favicon-16x16.png')}"> <link rel="icon" type="image/png" sizes="16x16" href="${require('../assets/ico/favicon-16x16.png')}">
<link rel="manifest" href="${require('../assets/ico/manifest.json')}">
<link rel="mask-icon" href="${require('../assets/ico/safari-pinned-tab.svg')}" color="#5bbad5"> <link rel="mask-icon" href="${require('../assets/ico/safari-pinned-tab.svg')}" color="#5bbad5">
<link rel="shortcut icon" href="${require('file-loader!../assets/ico/favicon.ico')}"> <link rel="shortcut icon" href="${require('../assets/ico/favicon.ico')}">
<meta name="msapplication-config" content="${require('file-loader!../assets/ico/browserconfig.xml')}"> <meta name="msapplication-config" content="${require('../assets/ico/browserconfig.xml')}">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
</head> </head>

View File

@ -3,13 +3,13 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackBuildNotifierPlugin = require('webpack-build-notifier'); const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin'); const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
const { ProvidePlugin } = require('webpack'); const { ProvidePlugin } = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const npmPackage = require('./package.json'); const npmPackage = require('./package.json');
module.exports = { module.exports = {
entry: { entry: {
vendors: './app/vendors.js', main: './app/__module.js'
main: './app/__module.js',
}, },
output: { output: {
filename: '[name].[hash].js', filename: '[name].[hash].js',
@ -37,17 +37,29 @@ module.exports = {
] ]
}, },
{ {
test: /\.(woff|woff2|eot|ttf|svg)$/, test: /\.(woff|woff2|eot|ttf|svg|)$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.(png|jpg|gif)$/,
use: [ use: [
{ {
loader: 'file-loader' loader: 'url-loader',
options: { limit: 25000 }
} }
] ]
}, },
{
test: /\.(ico|png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 25000
}
}
]
},
{
test: /.xml$/,
use: 'file-loader'
},
{ {
test: /\.css$/, test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader?sourceMap'] use: [MiniCssExtractPlugin.loader, 'css-loader?sourceMap']
@ -61,10 +73,11 @@ module.exports = {
templateParameters: { templateParameters: {
name: npmPackage.name, name: npmPackage.name,
author: npmPackage.author author: npmPackage.author
} },
manifest: './assets/ico/manifest.json'
}), }),
new WebpackBuildNotifierPlugin({ new WebpackBuildNotifierPlugin({
title: 'My Project Webpack Build', title: 'Portainer build',
logo: path.resolve('./assets/favicon-32x32.png'), logo: path.resolve('./assets/favicon-32x32.png'),
suppressSuccess: true suppressSuccess: true
}), }),
@ -73,13 +86,27 @@ module.exports = {
$: 'jquery', $: 'jquery',
jQuery: 'jquery', jQuery: 'jquery',
'window.jQuery': 'jquery' 'window.jQuery': 'jquery'
// angular: 'angular'
}), }),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output // Options similar to the same options in webpackOptions.output
// both options are optional // both options are optional
filename: "[name].css", filename: '[name].css',
chunkFilename: "[id].css" chunkFilename: '[id].css',
}) sourceMap: true
] }),
new CleanWebpackPlugin(['dist/public'])
],
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: 'initial',
name: 'vendor',
priority: 10,
enforce: true
}
}
}
}
}; };