JSFiddle - React, Tailwind, and code Playground
by alexdickson
CSS
#selector-1 {
}
/* comment { not a selector } */
.selector-2 {
}
JavaScript
var selectors = 0;
$('style').each(function() {
var styles = $(this).html();
// Strip comments
styles = styles.replace(/\/\*.+?\*\//sg, '');
console.log(styles);
var matches = styles.match(/\{[\s.]*\}/g);
selectors += matches.length;
});
document.body.innerHTML = selectors;