JSFiddle - React, Tailwind, and code Playground
by andypotanin
HTML
<script src="http://cdn.udx.io/udx.requires.js"></script>
JavaScript
console.clear();
require.config({
config: {
// we can set module-specific settings here
app: {
dogs: true,
cats: false
}
}
});
define( 'app', [ "module", "require", "exports" ], function appController( module, require, exports ) {
console.log( module.id, 'invoked' );
// we can get to module-specfic settings using module.config()
console.log( "dogs:", module.config().dogs );
console.log( "cats:", module.config().cats );
// we could even export the app's settings like so:
module.exports = {
config: module.config() ,
someOtherStuff: {}
}
});
// then, at some point in the future, we can get modules-specific settings like this:
setTimeout(function() {
console.log( 'later on, app config can be loaded using require("app")..:', require( 'app' ).config );
}, 1000 );