You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you parse using --components=true the css file generated works for the most part. The only main problem is that it generates duplicate classes if many elements with the same class exist in the original file.
For example if you have the following:
<divclass="alert alert-warning">
some warning alert
</div>
.
some other code
.
<divclass="alert alert-danger">
this is a second alert.. but now is danger
</div>
@abdumu
Here is example code (not from me) that would help with this issue
$cssContent = <all css, right before you write it to the component.css file>
// Use regex to remove duplicate classes
$cleanedCSS = preg_replace('/(class\s*=\s*["\'][^"\']*["\'])[\s\S]*?\1/', '$1', $cssContent);
Now you have $cleanedCSS, which you can write to that component.css file.
You would probably need a PHPUnit test for this, correct?
@abdumu Here is example code (not from me) that would help with this issue
$cssContent = <all css, right before you write it to the component.css file>
// Use regex to remove duplicate classes
$cleanedCSS = preg_replace('/(class\s*=\s*["\'][^"\']*["\'])[\s\S]*?\1/', '$1', $cssContent);
Now you have $cleanedCSS, which you can write to that component.css file.
You would probably need a PHPUnit test for this, correct?
yes we need to test it before. it would be amazing if you make a PR for this.
When you parse using
--components=true
the css file generated works for the most part. The only main problem is that it generates duplicate classes if many elements with the same class exist in the original file.For example if you have the following:
see that
.alert
is duplicatedThe text was updated successfully, but these errors were encountered: