Skip to content

Commit

Permalink
fixed size
Browse files Browse the repository at this point in the history
  • Loading branch information
c7d5a6 committed Feb 10, 2020
1 parent 4186be0 commit 915f820
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 143 deletions.
4 changes: 2 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<script src="https://kit.fontawesome.com/4f95a10a0e.js" crossorigin="anonymous"></script>
<!-- End Google Analytics -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-select.min.css">

<style>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"favicons-webpack-plugin": "^3.0.1",
"favicons-webpack-plugin": "2.1.0",
"file-loader": "^5.0.2",
"fuzzy-search": "^3.1.0",
"html-loader": "^0.5.5",
Expand Down Expand Up @@ -90,6 +90,7 @@
"node-sass": "^4.13.1",
"protractor": "^5.4.3",
"sw-offline-google-analytics": "^0.0.25",
"uglifyjs-webpack-plugin": "^2.2.0",
"webdriver-manager": "^12.1.7"
}
}
177 changes: 88 additions & 89 deletions webpack.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
const path = require('path');
const webpack = require('webpack');
const {
CleanWebpackPlugin
CleanWebpackPlugin,
} = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const {
GenerateSW
} = require('workbox-webpack-plugin')
GenerateSW,
} = require('workbox-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const VersionFile = require('webpack-version-file');
const HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');

function getCommonConfig() {
return {
entry: {
app: './app/app.module.js'
app: './app/app.module.js',
},
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules)/,
use: ['babel-loader']
use: ['babel-loader'],
}, {
test: /\.html$/,
use: ['html-loader']
use: ['html-loader'],
}, {
test: /\.s[ac]ss$/i,
use: [
Expand All @@ -39,31 +38,31 @@ function getCommonConfig() {
],
}, {
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
use: [MiniCssExtractPlugin.loader, 'css-loader'],
}, {
test: /\.(png|svg|jpg|gif)$/,
use: [{
loader: 'file-loader',
options: {
esModule: false,
}
}]
},
}],
}, {
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: ['file-loader']
use: ['file-loader'],
}, {
test: /\.properties$/,
use: ['properties-loader']
use: ['properties-loader'],
}, {
test: /\.md$/,
use: [{
loader: "html-loader"
},
{
loader: "markdown-loader",
}
]
}]
loader: 'html-loader',
},
{
loader: 'markdown-loader',
},
],
}],
},
plugins: [
new CleanWebpackPlugin({
Expand All @@ -72,25 +71,25 @@ function getCommonConfig() {
}),
new HtmlWebpackPlugin({
template: './app/index.html',
filename: 'index.html'
filename: 'index.html',
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css'
filename: '[name].[contenthash].css',
}),
new webpack.HashedModuleIdsPlugin(),
new CopyWebpackPlugin([{
from: 'assets/CNAME'
from: 'assets/CNAME',
}, {
from: 'assets/robots.txt'
from: 'assets/robots.txt',
}, {
from: 'assets/sitemap.xml'
from: 'assets/sitemap.xml',
}, {
from: 'assets/logo.png'
from: 'assets/logo.png',
}, {
from: 'assets/google989809d758b4217a.html'
}])
]
}
from: 'assets/google989809d758b4217a.html',
}]),
],
};
}

module.exports = (env, argv) => {
Expand All @@ -101,38 +100,38 @@ module.exports = (env, argv) => {
contentBase: './dist',
historyApiFallback: true,
publicPath: '/',
port: 9000
port: 9000,
};
config.output = {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
filename: '[name].js',
};
config.plugins.push(new GenerateSW({
clientsClaim: true,
skipWaiting: true
skipWaiting: true,
}));
}

if (argv.mode === 'test') {
config.optimization = {
minimize: false
}
minimize: false,
};
}

if (argv.mode === 'production') {
config.output = {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].js'
filename: '[name].[hash].js',
};
config.devtool = 'inline-source-map';
config.devServer = {
contentBase: './dist',
historyApiFallback: true,
publicPath: '/'
publicPath: '/',
};
config.optimization = {
minimizer: [
new TerserPlugin(), new OptimizeCSSAssetsPlugin({})
new UglifyJsPlugin(), new TerserPlugin(), new OptimizeCSSAssetsPlugin({}),
],
splitChunks: {
chunks: 'all',
Expand All @@ -149,23 +148,23 @@ module.exports = (env, argv) => {
test: /\.json/,
// chunks: 'all',
enforce: true,
maxSize: 244000
maxSize: 244000,
},
vendor: {
name: 'vendor',
test: /[\\/]node_modules[\\/]/,
// chunks: 'all',
enforce: true,
maxSize: 244000
}
}
}
maxSize: 244000,
},
},
},
};
config.plugins.push(
new VersionFile({
output: './dist/version.txt',
verbose: true
})
verbose: true,
}),
);
config.plugins.push(new FaviconsWebpackPlugin({
logo: './assets/logo.png',
Expand All @@ -180,66 +179,66 @@ module.exports = (env, argv) => {
opengraph: true,
twitter: true,
yandex: true,
windows: true
}
windows: true,
},
}));
config.plugins.push(new GenerateSW({
clientsClaim: true,
skipWaiting: true
skipWaiting: true,
}));
config.plugins.push(new WebpackPwaManifest({
name: 'ScrollBear Spellbook',
short_name: 'ScrollBear',
description: 'Scrollbear spellbook reference for Pathfinder RPG.',
background_color: '#463e43',
crossorigin: 'anonymous', //can be null, use-credentials or anonymous
crossorigin: 'anonymous', // can be null, use-credentials or anonymous
theme_color: '#463e43',
'theme-color': '#463e43',
start_url: '/',
standalone: 'standalone',
icons: [{
"src": path.resolve("resources/img/android-chrome-36x36.png"),
"sizes": "36x36",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-48x48.png"),
"sizes": "48x48",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-72x72.png"),
"sizes": "72x72",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-96x96.png"),
"sizes": "96x96",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-144x144.png"),
"sizes": "144x144",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-192x192.png"),
"sizes": "192x192",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-256x256.png"),
"sizes": "256x256",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-384x384.png"),
"sizes": "384x384",
"type": "image/png"
}, {
"src": path.resolve("resources/img/android-chrome-512x512.png"),
"sizes": "512x512",
"type": "image/png"
}]
src: path.resolve('resources/img/android-chrome-36x36.png'),
sizes: '36x36',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-48x48.png'),
sizes: '48x48',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-72x72.png'),
sizes: '72x72',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-96x96.png'),
sizes: '96x96',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-144x144.png'),
sizes: '144x144',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-192x192.png'),
sizes: '192x192',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-256x256.png'),
sizes: '256x256',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-384x384.png'),
sizes: '384x384',
type: 'image/png',
}, {
src: path.resolve('resources/img/android-chrome-512x512.png'),
sizes: '512x512',
type: 'image/png',
}],
}));
}

config.plugins.push(new webpack.DefinePlugin({
APP_VERSION: (env && env.version) ? JSON.stringify(env.version) : JSON.stringify('0.0.0')
APP_VERSION: (env && env.version) ? JSON.stringify(env.version) : JSON.stringify('0.0.0'),
}));

return config;
}
};
Loading

0 comments on commit 915f820

Please sign in to comment.