Skip to content

Instantly share code, notes, and snippets.

@laurisstepanovs
Last active August 7, 2023 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laurisstepanovs/60c48355ee1c4408bd415ae62344b359 to your computer and use it in GitHub Desktop.
Save laurisstepanovs/60c48355ee1c4408bd415ae62344b359 to your computer and use it in GitHub Desktop.
const path = require('path');
const WebpackRTLPlugin = require('webpack-rtl-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const RemovePlugin = require('remove-files-webpack-plugin');
// global variables
const distPath = `${path.resolve(__dirname)}/src/_metronic/assets/rtl`;
const entries = { style: './src/_metronic/assets/sass/style.scss' };
module.exports = {
entry: entries,
output: {
// main output path in assets folder
path: distPath,
// output path based on the entries filename
filename: '[name].js',
// clean existing output folder
clean: true,
},
resolve: {
extensions: ['.scss'],
},
module: {
rules: [
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
}),
new WebpackRTLPlugin(),
new RemovePlugin({
// delete uneeded files from webpack output
after: {
root: distPath,
include: ['style.js', 'style.css'],
trash: true,
},
}),
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment