# webpack-plugin-set-class-name **Repository Path**: mebell/webpack-plugin-set-class-name ## Basic Information - **Project Name**: webpack-plugin-set-class-name - **Description**: 将编译后的文件中class name修改为随机的字符串 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-04-21 - **Last Updated**: 2023-05-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # webpack-plugin-set-class-name ## 概述 Summary Webpack 插件 支持版本 3,4,5 将编译后的文件中class name修改为随机的字符串 Webpack Plugin Supports versions 3,4,5 Change the class name to a random string in the compiled file ## 用法 Usage ### 安装 install ``` npm install webpack-plugin-set-class-name ``` ### 引入 import ``` const WebpackPluginSetClassName = require('webpack-plugin-set-class-name') ``` ### 使用 use ``` plugins: [ ..., new WebpackPluginSetClassName({ from: ['./dist/js/**.js'], // 需要修改的文件; 详细书写规则请查看globby split: ['className:"', '"'], // 拆分开始和结束依赖字符串 regex: /^(class-name-prefix1|class-name-prefix2)[A-Za-z0-9_-]*/ // 需要替换的className匹配正则 }) ] ``` ### Options from: 需要修改的文件; 详细书写规则请查看globby Files to be modified; See globby for detailed writing rules split: 拆分开始和结束依赖字符串 Split the start and end dependent strings regex: 需要替换的className匹配正则 The className to be replaced matches the RE