1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var helpers_1 = require("../util/helpers");
|
4 | function buildIonicGlobal(context) {
|
5 | context.ionicGlobal = context.ionicGlobal || {};
|
6 |
|
7 | var systemData = helpers_1.getSystemData(context.rootDir);
|
8 | if (systemData.ionicFramework) {
|
9 | context.ionicGlobal['version'] = "'" + systemData.ionicFramework + "'";
|
10 | }
|
11 | if (systemData.angularCore) {
|
12 | context.ionicGlobal['angular'] = "'" + systemData.angularCore + "'";
|
13 | }
|
14 | if (systemData.ionicNative) {
|
15 | context.ionicGlobal['ionicNative'] = "'" + systemData.ionicNative + "'";
|
16 | }
|
17 | var staticDir = helpers_1.toUnixPath(context.buildDir.replace(context.wwwDir, ''));
|
18 | staticDir += '/';
|
19 | if (staticDir.charAt(0) === '/') {
|
20 | staticDir = staticDir.substring(1);
|
21 | }
|
22 | context.ionicGlobal['staticDir'] = "'" + staticDir + "'";
|
23 |
|
24 | var o = [
|
25 | '(function(w){',
|
26 | 'var i=w.Ionic=w.Ionic||{};'
|
27 | ];
|
28 | Object.keys(context.ionicGlobal).forEach(function (key) {
|
29 | o.push("i." + key + "=" + context.ionicGlobal[key] + ";");
|
30 | });
|
31 | o.push('})(window);');
|
32 | return o.join('');
|
33 | }
|
34 | exports.buildIonicGlobal = buildIonicGlobal;
|