Skip to content
Include files and Import/Export data library for JS
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
bower.json
index.js
readme.md

readme.md

Dependencies.js

Installation

bower install dependencies.js --save

Dependencies

Methods

$include(url, callback, tag);

  • String url: File to load
  • Function callback: Function to call on finish (Optional)
  • String tag: tag to return in callback (Optional)

$includeFile(url, callback);

  • String url: 'include.json' file to load
  • Function callback: Function to call on finish (Optional)

$import(tag);

  • String tag: tag to import

$export(tag, data);

  • String tag: tag name for data
  • Object data: data to export

include.json

  • We have 2 categories: libs & app
    Dependencies.js will firs run the 'libs' config and when he ends will continue with 'app'.
  • Priorities mark the execution order.
    In 'libs' it will download 'jquery' first, 'angular' second and 'ionic' & 'ng-routes' asynchronously in third place
{
  "libs": [
    {
      "path": "lib/angular.js",
      "name": "angular",
      "priority": 2
    },
    {
      "path": "lib/jquery.js",
      "name": "jquery",
      "priority": 1
    },
    {
      "path": ["lib/ionic.js", "lib/angular-routes.js"],
      "name": "angular-modules",
      "priority": 3
    }
  ],
  "app": [
    {
      "path": "lib/app.core",
      "name": "core-module",
      "priority": 1
    },
    {
      "path": ["lib/core.settings", "lib/core.helpers"],
      "name": "core-components",
      "priority": 2
    },
    {
      "path": "lib/app.main",
      "name": "app-module",
      "priority": 3
    }
  ]
}
Something went wrong with that request. Please try again.