https://github.com/minutebase/ember-inject-script
Easily inject 3rd party scripts in ember-cli apps
https://github.com/minutebase/ember-inject-script
Last synced: about 1 year ago
JSON representation
Easily inject 3rd party scripts in ember-cli apps
- Host: GitHub
- URL: https://github.com/minutebase/ember-inject-script
- Owner: minutebase
- License: mit
- Created: 2014-10-06T20:58:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-01T08:13:28.000Z (about 9 years ago)
- Last Synced: 2025-03-25T14:03:48.417Z (about 1 year ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 19
- Watchers: 2
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-inject-script
Inject 3rd party scripts into your ember-cli app, for example `mixpanel`, `Typekit` etc...
## Installation
Install as an Ember CLI addon:
```
npm install --save-dev ember-inject-script
```
## Usage
For example, lets configure Typekit.
`loadScript` returns a promise, so we can simply load in the Typekit JS and, when it's ready, call `Typekit.load()`:
```javascript
/* global Typekit */
import injectScript from 'ember-inject-script';
import config from 'your-app/config/environment';
export default {
name: 'typekit',
initialize: function() {
var url = "//use.typekit.net/"+config.typekitID+".js";
injectScript(url).then(function() {
Typekit.load();
});
}
};
```
## Developing
### Installation
* `git clone` this repository
* `npm install`
* `bower install`
### Running
* `ember server`
* Visit your app at http://localhost:4200.
### Running Tests
* `ember test`
* `ember test --server`
### Building
* `ember build`
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).