diff --git a/config/medias.default.php b/config/medias.default.php index 0cfb0a3..c41e53a 100644 --- a/config/medias.default.php +++ b/config/medias.default.php @@ -7,6 +7,9 @@ const UGLY_JS_SRC = HTTP_ROOT.'/dist/global.min.js'; const JS_SRC = HTTP_ROOT.'/dist/global.js'; +// "AMD" lite module loader +const JS_MODULE_LOADER = '(function(){var n={};define=function(i,o,c){c.apply(this,o.map(function() {return n}))}})()'; + const UGLY_CSS_SRC = HTTP_ROOT.'/dist/global.min.css'; const CSS_SRC = HTTP_ROOT.'/dist/global.css'; diff --git a/src/class/Document.php b/src/class/Document.php index f0d80e8..9ab436a 100644 --- a/src/class/Document.php +++ b/src/class/Document.php @@ -68,10 +68,9 @@ public function __construct($title, $outputOneFile = false) ); } else { $this->head->style(CONFIG\MEDIAS\CSS_SRC); - // "AMD" lite module loader $this->head->appendChild($this->createElement('script')) ->append( - $this->dom->createCDATASection('(function(){var n={};define=function(i,o,c){c(null,n,n)}})()') + $this->dom->createCDATASection(CONFIG\MEDIAS\JS_MODULE_LOADER) ); $this->head->script(CONFIG\MEDIAS\JS_SRC); } @@ -105,6 +104,7 @@ public function __destruct() // Inlining minified JS $this->getBody()->script()->append( $this->dom->createCDATASection( + CONFIG\MEDIAS\JS_MODULE_LOADER.';'. file_get_contents(SRC_DIR . DIRECTORY_SEPARATOR .CONFIG\MEDIAS\UGLY_JS_SRC) ) );