vanilla-jet 1.0.25 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,13 @@ let Functions = require('../framework/functions.js');
10
10
  let Dipper = require('../framework/dipper.js');
11
11
  let Config = require(processCwd() + '/config.js');
12
12
 
13
+ // -- Get environment
14
+ let env = process.argv[2] || 'development';
15
+ if (env === 'dev') { env = 'development'; }
16
+ if (env === 'build:qa') { env = 'qa'; }
17
+ if (env === 'build:prod') { env = 'production'; }
18
+
13
19
  // -- Init Dipper
14
- const env = process.argv[2] || 'development';
15
20
  let settings = Config.settings;
16
21
  settings['shared']['environment'] = env;
17
22
 
@@ -18,7 +18,8 @@ async function main() {
18
18
  },
19
19
  dependencies: {},
20
20
  styles: {},
21
- fonts: {}
21
+ fonts: {},
22
+ anims: {}
22
23
  };
23
24
  //console.log(json);
24
25
  console.log("Creating the package.json file...");
@@ -22,7 +22,8 @@ function Dipper(options, shared) {
22
22
  'images' : '/public/images/',
23
23
  'scripts' : '/public/scripts/',
24
24
  'styles' : '/public/styles/',
25
- 'fonts' : '/public/fonts/'
25
+ 'fonts' : '/public/fonts/',
26
+ 'anims' : '/public/anims/'
26
27
  }
27
28
 
28
29
  // -- Static content
@@ -212,6 +213,15 @@ Dipper.prototype.registerScript = function(
212
213
  };
213
214
  }
214
215
 
216
+ Dipper.prototype.registerAnimation = function(name, url) {
217
+
218
+ let obj = this;
219
+ obj.anims[name] = {
220
+ 'resource' : url,
221
+ 'requires' : []
222
+ };
223
+ }
224
+
215
225
  Dipper.prototype.enqueueStyle = function(name) {
216
226
 
217
227
  var obj = this,
@@ -328,6 +338,23 @@ Dipper.prototype.includeScript = function(script) {
328
338
  }
329
339
  }
330
340
 
341
+ Dipper.prototype.includeAnimation = function(anim) {
342
+
343
+ let obj = this;
344
+ if (obj.anims[anim]) {
345
+
346
+ let item = obj.anims[anim],
347
+ output = '',
348
+ resource = item['resource'];
349
+
350
+ if (!/^(https?:\/\/|\/\/)/.test(resource)) {
351
+ let jsonAnim = obj.openJsonFile(resource);
352
+ output = `var ${item['name']} = ${JSON.stringify(jsonAnim)};`;
353
+ }
354
+ return output + "\n";
355
+ }
356
+ }
357
+
331
358
  Dipper.prototype.includeStyles = function() {
332
359
 
333
360
  var obj = this,
@@ -357,6 +384,20 @@ Dipper.prototype.includeScripts = function () {
357
384
  return scriptsString;
358
385
  }
359
386
 
387
+ Dipper.prototype.includeAnimations = function() {
388
+
389
+ let obj = this,
390
+ _ = require('underscore'),
391
+ animsString = '',
392
+ keys = Object.keys(obj.anims);
393
+
394
+ _.each(keys, function(anim) {
395
+ animsString += obj.includeAnim(anim);
396
+ });
397
+ let baseAnimsString = `<script>'${animsString}'</script>`;
398
+ return baseAnimsString;
399
+ }
400
+
360
401
  Dipper.prototype.includeManifest = function() {
361
402
 
362
403
  var obj = this,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-jet",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "VannilaJet framework",
5
5
  "main": "index.js",
6
6
  "bin": {