[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="apple-touch-icon" href="static/icons/apple-touch-icon.png">
<link rel="icon" href="static/icons/favicon.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 --> <!-- built styles file will be auto injected -->
</head> </head>

View file

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