JSFiddle - React, Tailwind, and code Playground
JavaScript
$.extend({
getCss: function(urls, callback, nocache){
if (typeof nocache=='undefined') nocache=false; // default don't refresh
$.when(
$.each(urls, function(i, url){
if (nocache) url += '?_ts=' + new Date().getTime(); // refresh?
$.ajax({
url: url,
cache: false,
success: function(){
$('<link>', {rel:'stylesheet', type:'text/css', 'href':url}).appendTo('head');
}
});
})
).then(function(){
if (typeof callback=='function') callback();
});
},
});
var cssfiles=['/css/normalize.css?jobofferinsidebar', '/css/tricks.css?jobofferinsidebar'];
$.getCss(cssfiles, function(){
console.log('all css loaded');
});