styles moved from js bundle to css bundle

This commit is contained in:
NikolaBorislavovHristov 2019-07-31 11:03:03 +03:00
parent dbe9fa3b6e
commit 855644896f
4 changed files with 25 additions and 5 deletions

View file

@ -44,9 +44,9 @@
"html-webpack-plugin": "3.2.0",
"less": "3.9.0",
"less-loader": "5.0.0",
"mini-css-extract-plugin": "0.8.0",
"postcss-loader": "3.0.0",
"storybook-addon-jsx": "7.1.5",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.3.0",
"webpack": "4.36.1",
"webpack-cli": "3.3.6",

View file

@ -5,6 +5,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1" />
<title>Stremio - All you can watch!</title>
<style>
<%= compilation.assets['styles.css'].source() %>
</style>
</head>
<body>

View file

@ -1,6 +1,7 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
@ -34,14 +35,17 @@ module.exports = {
exclude: /node_modules/,
use: [
{
loader: 'style-loader'
loader: MiniCssExtractPlugin.loader,
options: {
reloadAll: true
},
},
{
loader: 'css-loader',
options: {
importLoaders: 2,
modules: {
localIdentName: '[local]_[hash:base64:5]',
localIdentName: '[local]_[hash:base64:5]'
}
}
},
@ -138,10 +142,13 @@ module.exports = {
template: './src/index.html',
inject: false
}),
new MiniCssExtractPlugin({
filename: 'styles.css',
}),
new CleanWebpackPlugin({
verbose: true,
cleanOnceBeforeBuildPatterns: [],
cleanAfterEveryBuildPatterns: ['./bundle.js']
cleanAfterEveryBuildPatterns: ['./bundle.js', './styles.css']
})
]
};

View file

@ -6117,6 +6117,16 @@ min-document@^2.19.0:
dependencies:
dom-walk "^0.1.0"
mini-css-extract-plugin@0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz#81d41ec4fe58c713a96ad7c723cdb2d0bd4d70e1"
integrity sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw==
dependencies:
loader-utils "^1.1.0"
normalize-url "1.9.1"
schema-utils "^1.0.0"
webpack-sources "^1.1.0"
mini-css-extract-plugin@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.7.0.tgz#5ba8290fbb4179a43dd27cca444ba150bee743a0"
@ -8773,7 +8783,7 @@ strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
style-loader@0.23.1, style-loader@^0.23.1:
style-loader@^0.23.1:
version "0.23.1"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925"
integrity sha512-XK+uv9kWwhZMZ1y7mysB+zoihsEj4wneFWAS5qoiLwzW0WzSqMrrsIy+a3zkQJq0ipFtBpX5W3MqyRIBF/WFGg==