DrupalGap icon indicating copy to clipboard operation
DrupalGap copied to clipboard

Load JavaScript and/or CSS libraries as needed

Open signalpoint opened this issue 8 years ago • 2 comments

We want to support something like this: https://www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-module

Proposed DG8 code usage:

var element = {};
element.foo = {
  _markup: '<p></p>',
  _attached: {
    dg_google: ['maps']
  }
};
return element;

The values within the _attached property should should multiple libraries from a namespace as an array e.g. ['maps', 'geocoder']

signalpoint avatar Dec 01 '17 03:12 signalpoint

This feature has been added, awesome!

http://docs.drupalgap.org/8/Developer_Guide/Adding_CSS_and_JavaScript

signalpoint avatar Dec 02 '17 04:12 signalpoint

I'm re-opening this, we need to load the assets one after another, because one may be dependent on the other loading first, case in point, Firebase requires firebase and app .js files before the messaging .js file can be loaded.

signalpoint avatar Dec 13 '17 02:12 signalpoint