JPeer264 / node-rename-css-selectors

📝 Rename css classes and id's in files
MIT License
65 stars 9 forks source link

[Q] Webpack Usage? #78

Open heychazza opened 3 years ago

heychazza commented 3 years ago

Hey buddy,

Is there any chance you can provide a usage example with Webpack?

JPeer264 commented 3 years ago

Hey. Actually there are couple of plugins documented in the core library: https://github.com/JPeer264/node-rcs-core#plugins

Might be useful to also add them in this repo. If you haven't seen it already, there is a webpack plugin for rcs: https://www.npmjs.com/package/rcs-webpack-plugin

heychazza commented 3 years ago

The usage for https://www.npmjs.com/package/rcs-webpack-plugin, where does this go? The docs don't specify aha

heychazza commented 3 years ago

In addition,

const { rcs } = require('rcs-core')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const RcsWebpackPlugin = require('rcs-webpack-plugin')

mix.webpackConfig({
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    { loader: MiniCssExtractPlugin.loader },
                    'css-loader',
                ],
            },
        ],
    },
    plugins: [
        new MiniCssExtractPlugin(),
        new RcsWebpackPlugin(),
    ],
})

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): Error: Didn't get a result from child compiler

JPeer264 commented 3 years ago

This actually seems like a mini-css-extract-plugin issue. I've never used Laravel Mix (if that is that one), but maybe you have some scss files in it where you also need a sass-loader and use test: /\.s?css$/, as file tester?

heychazza commented 3 years ago

This actually seems like a mini-css-extract-plugin issue. I've never used Laravel Mix (if that is that one), but maybe you have some scss files in it where you also need a sass-loader and use test: /\.s?css$/, as file tester?

Theres no sass sadly, just tailwind .css file

JPeer264 commented 3 years ago

May I ask how you import the .css file?