-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
Instead specify the string (that will be replaced) with classNameRegExp
options, just grab all class name in CSS file and collect them into 1 array. After that replace all the string in JS and HTML code that matched with the string in the array that was collected before.
Example:
index.css
.alert {}
.button {}
.divider {}
index.js
doSomethingTo('alert')
doSomethingTo('button')
doSomethingTo('divider')
if('production') {
console.log('hello world')
}
production
&hello world
string will not replaced because they are is not listed inindex.css
file as a class name.
Generate the list of class names that contained inindex.css
:
['alert', 'button', 'divider']
and then replace all string in JS Code based on class name list that has been generated:
index.js
doSomethingTo('a')
doSomethingTo('b')
doSomethingTo('c')
if('production') {
console.log('hello world')
}
With method above, we don't need to specify a prefix in all of the class name in your exisiting project.
Metadata
Metadata
Assignees
Labels
No labels