GithubHelp home page GithubHelp logo

zachnthebox / ember-cli-amd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esri/ember-cli-amd

0.0 1.0 0.0 1.71 MB

Ember CLI Addon for using AMD libraries

License: Apache License 2.0

JavaScript 91.59% HTML 8.41%

ember-cli-amd's Introduction

Ember-cli-amd

The Ember loader is conflicting with the AMD loader. The Ember loader is not async and doesn't comply with the RequireJS or AMD specs.

This addon will:

  • Update the code generated by Ember to avoid conflicts with the AMD loader
  • Update the index.html:
    • load any pure AMD modules found in the code first using the AMD loader.
    • load the Ember code as AMD modules (app and vendor)
    • reference the AMD modules inside the Ember loader

View it live using the ArcGIS API for JavaScript.

Breaking changes

The version 2.x has removed some old and unecessary features.

Features

Usage

ember install ember-cli-amd

Update the ember-cli-build file. See configuration below as an example:

var app = new EmberApp({
  amd : {
    // Specify the loader path. Can be a CDN path or a relative path in the dist folder
    // - CDN: loader: 'https://js.arcgis.com/3.15/'
    // - Local: loader: 'assets/jsapi/dojo.js'
    loader: 'https://js.arcgis.com/4.11/',
    // User defined AMD packages used in the application
    // import foo from 'esri/foo';
    packages: ['esri','dojo','dojox','dijit','put-selector','xstyle','dgrid'],
    // Optional: The AMD configuration file path relative to the project root.
    // The file will be copied to the output directory (./dist) and the configuration file
    // will be loaded before the loader is loaded. The configuration file must define the global variable used by the specific loader.
    // For dojo, the supported global variable name are `dojoConfig`, `djConfig` or `require`.
    // For requirejs, the global variable is called `require`.
    // Please refer to the documentation for the correct use of the configuration object.
    configPath: 'config/dojo-config.js',
    // Optional: a list of relative paths from the build directory that should not be parsed by ember-cli-amd.
    // This is useful for:
    // - when using an AMD api locally and copied under public folder. The files will be copied under the build folder. These files are pure AMD
    //   modules and should not be converted.
    // - when copying from public to build directory files that are pure JS
    excludePaths: ['assets/jspai', 'assets/myLibThatDontUseEmberDefineOrRequire']
  }
});

Example using the CDN resources

// ember-cli-build.js
module.exports = function(defaults) {

  var app = new EmberApp(defaults, {
    amd :{
      loader: 'https://js.arcgis.com/3.15/',
      configPath: 'config/dojo-config.js',
      packages: ['esri','dojo','dojox','dijit','put-selector','xstyle','dbind','dgrid'],
      excludePaths: ['assets/workers']
    }
  });

  return app.toTree();
};
// config/dojo-config.js if using dojo
var dojoConfig = {
  async: true
};

Using a CDN for your application's assets

When using ember-cli-deploy it is common to deploy the assets of an ember application to a different location (cdn) from the index.html. The ember-cli-deploy documentation discusess how to use fingerprinting to prepend fully-qualified urls to the asset locations. As of v0.4.1 of ember-cli-amd these same options are applied to the AMD related scripts that are injected into the page, thus allowing this to work smoothly with ember-cli-deploy.

Running

Running tests

  • ember test
  • ember test --server

Running the dummy application

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright 2018 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file

ember-cli-amd's People

Contributors

ffaubry avatar odoe avatar dbouwman avatar tomwayson avatar keithclinard avatar bsvensson avatar jrowlingson avatar kategengler avatar 4e4c52 avatar ember-tomster avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.