red-perfume / red-perfume-task-runner

Experimental CSS Atomizer
https://red-perfume.github.io
MIT License
26 stars 4 forks source link

Remove duplicate properties from markup #36

Open TheJaredWilcurt opened 4 years ago

TheJaredWilcurt commented 4 years ago

This would be handled by a top level boolean on a task ({ removeDuplicateProperties: true }).

Currently this

.cow {
    padding: 4px;
}
.dog {
    padding: 8px;
}
<div class="dog cow"></div>

outputs this

.rp__padding__--COLON4px { padding: 4px; }
.rp__padding__--COLON8px { padding: 8px; }
<div class="rp__padding__--COLON8px rp__padding__--COLON4px"></div>

The actual outcome is the div will have a padding of 8px because that rule comes later in the CSS file.

It would be nice to automatically remove the rp__padding__--COLON4px from the markup if it isn't used. This would reduce the markup file size, and could also reduce the CSS size if we have a feature to remove unused CSS.

TheJaredWilcurt commented 2 years ago

Blocked by:

Once that feature is released, then this setting can be passed in to it from the task manager.