Skip to content
Snippets Groups Projects
Commit e065666c authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-11506 : Improve initial loading time of NG UI - offer both a bundle with...

SSDM-11506 : Improve initial loading time of NG UI - offer both a bundle with and without a minification
parent 06dc09c8
No related branches found
No related tags found
No related merge requests found
config.bundle.js config.bundle.*
openbis.bundle.js openbis.bundle.*
\ No newline at end of file \ No newline at end of file
...@@ -22,11 +22,13 @@ find ./as ./dss ./util -name "*.js" | sed 's/^.\//"/g' | sed 's/.js$/",/g' > $TE ...@@ -22,11 +22,13 @@ find ./as ./dss ./util -name "*.js" | sed 's/^.\//"/g' | sed 's/.js$/",/g' > $TE
cd $CURRENT_DIR cd $CURRENT_DIR
cat r.config.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/r.config.js cat r.config.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/r.config.js
cat config.bundle.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/config.bundle.js cat config.bundle.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/config.bundle.js
cat config.bundle.min.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/config.bundle.min.js
# create a JS bundle using NodeJS binary installed by NodeJS gradle plugin # create a JS bundle using NodeJS binary installed by NodeJS gradle plugin
$OPENBIS_STANDARD_TECHNOLOGIES_DIR/node/nodejs/node-*/bin/node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR $OPENBIS_STANDARD_TECHNOLOGIES_DIR/node/nodejs/node-*/bin/node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR optimize=none out=$TEMP_DIR/openbis.bundle.js
$OPENBIS_STANDARD_TECHNOLOGIES_DIR/node/nodejs/node-*/bin/node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR optimize=uglify out=$TEMP_DIR/openbis.bundle.min.js
# copy relevant files to the V3 public folder # copy relevant files to the V3 public folder
cp $TEMP_DIR/config.bundle.js $TEMP_DIR/openbis.bundle.js $V3_DIR cp $TEMP_DIR/config.bundle.js $TEMP_DIR/config.bundle.min.js $TEMP_DIR/openbis.bundle.js $TEMP_DIR/openbis.bundle.min.js $V3_DIR
popd > /dev/null popd > /dev/null
\ No newline at end of file
var require = (function () {
var getBaseUrl = function () {
// To find where the V3 API has been loaded from we scan the script tags until finding this file
// This way is possible to load the V3 API from a separate domain
var scripts = document.getElementsByTagName('script')
var baseUrl = null
for (var sIdx = 0; sIdx < scripts.length; sIdx++) {
var src = scripts[sIdx].src
var substringEnd = -1
if ((substringEnd = src.indexOf('/api/v3/config.bundle.min.js')) > -1) {
baseUrl = src.substring(0, substringEnd + '/api/v3'.length)
}
}
return baseUrl
}
return {
baseUrl: getBaseUrl(),
bundles: {
'openbis.bundle.min': [
'jquery',
'stjs',
'underscore',
'moment',
//
__FILES__
//
]
}
}
})()
...@@ -18,7 +18,5 @@ ...@@ -18,7 +18,5 @@
underscore: { underscore: {
exports: '_' exports: '_'
} }
}, }
out: 'openbis.bundle.js',
optimize: 'none'
}) })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment