Skip to content

Commit

Permalink
Add support for theme-based styles in SFCs
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkykh committed Jun 12, 2019
1 parent 0e44148 commit 4a9f712
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion themes-default/slim/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const { ProvidePlugin } = require('webpack');
const { NormalModuleReplacementPlugin, ProvidePlugin } = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
Expand Down Expand Up @@ -182,6 +182,12 @@ const makeConfig = (theme, isProd) => ({
jQuery: 'jquery'
}),
new VueLoaderPlugin(),
// Disable other themes' styles in SFCs
new NormalModuleReplacementPlugin(
// Match vue SFC styles where the theme name differs from the current theme (`&theme=[name]`)
new RegExp(String.raw`\?vue&type=style.+&theme=(?!${theme.name})(&|.*$)`),
'lodash/noop'
),
new OptimizeCssAssetsPlugin({}),
new MiniCssExtractPlugin({
filename: 'css/[name].css'
Expand Down

0 comments on commit 4a9f712

Please sign in to comment.