JSFiddle - React, Tailwind, and code Playground

by schmidjon

JavaScript

const baseUrl = 'https://forms.codeyourfuture.io';
function addStylesheet (path) {
	const element = document.createElement('link');
  element.rel = 'stylesheet';
  element.href = baseUrl + path;
  document.getElementsByTagName('head')[0].appendChild(element);
}
function addScript (path) {
	const element = document.createElement('script');
  element.type = 'text/javascript';
  element.src = baseUrl + path;
  document.getElementsByTagName('body')[0].appendChild(element);
}
fetch(baseUrl + '/asset-manifest.json')
  .then(function(response) {
    return response.json();
  })
  .then(function(assets) {
    addStylesheet(assets['main.css']);
    addScript(assets['main.js']);
  });