JSFiddle - React, Tailwind, and code Playground

HTML

<div>Test</div>

CSS

@import url('/css/normalize.css');
div { color : red; }

JavaScript

/**
         * Get the css rules of a stylesheet which apply to the htmlNode. Meaning its class
         * its id and its tag.
         * @param CSSStyleSheet styleSheet
         */
        function getCssRules(styleSheet) {
            if ( !styleSheet )
                return null;

            var cssRules = new Array();
            if (styleSheet.cssRules) {
                var currentCssRules = styleSheet.cssRules;
                // Import statement are always at the top of the css file.
                for ( var i = 0; i < currentCssRules.length; i++ ) {
                    // cssRules contains the import statements.
                    // check if the rule is an import rule.
                    if ( currentCssRules[i].type == 3 ) {
                        // import the rules from the imported css file.
                        var importCssRules = getCssRules(currentCssRules[i].styleSheet);
                        if ( importCssRules != null ) {
                            // Add the rules from the import css file to the list of css rules.
                            cssRules = addToArray(cssRules, importCssRules);
                        }
                        // Remove the import css rule from the css rules.
                        styleSheet.deleteRule(i);
                    }
                    else {
                        // We found a rule that is not an CSSImportRule
                        break;
                    }
                }
                // After adding the import rules (lower priority than those in the current stylesheet),
                // add the rules in the current stylesheet.
                cssRules = addToArray(cssRules, currentCssRules);
            }


            return cssRules;
        }
        
        /**
         * Since a list of rules is returned, we cannot use concat. 
         * Just use old good push....
         * @param CSSRuleList cssRules
         * @param CSSRuleList cssRules
         */
       ...