[SSE mobile] inline skeleton styles to html

This commit is contained in:
Maxim Kadushkin 2021-09-27 21:55:45 +03:00
parent 858c7a3ad4
commit 594db69572
3 changed files with 12 additions and 4 deletions

View file

@ -23,7 +23,11 @@
<link rel="apple-touch-icon" href="static/icons/apple-touch-icon.png">
<link rel="icon" href="static/icons/favicon.png">
<link rel="stylesheet" type="text/css" href="../../common/mobile/resources/less/skeleton.css">
<% if (!htmlWebpackPlugin.options.skeleton.content) { %>
<link rel="stylesheet" href="../../common/mobile/resources/css/skeleton.css">
<% } else { %>
<style><%= htmlWebpackPlugin.options.skeleton.content %></style>
<% } %>
<!-- built styles file will be auto injected -->
</head>

View file

@ -89,6 +89,7 @@ module.exports = {
{
test: /\.css$/,
exclude: [/skeleton\.css$/i],
use: [
(env === 'development' ? 'style-loader' : {
loader: MiniCssExtractPlugin.loader,
@ -188,6 +189,9 @@ module.exports = {
// new webpack.NamedModulesPlugin(),
]),
// new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
}),
new HtmlWebpackPlugin({
filename: `../../../apps/${editor}/mobile/index.html`,
template: `../../apps/${editor}/mobile/src/index_dev.html`,
@ -200,9 +204,9 @@ module.exports = {
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
} : false,
}),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
skeleton: {
content: env === 'development' ? undefined : fs.readFileSync(`../../apps/common/mobile/resources/css/skeleton.css`),
},
}),
new CopyWebpackPlugin({
patterns: [