-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #4888 - seanpdoyle:vendor-shim-blueprint, r=stefanpenner
Introduce the `vendor-shim` blueprint There isn't much documentation around how to properly wrap an otherwise global `window` dependency in an ES6 compliant module. The generated blueprint will nudge consumers in the correct direction. Insprired by [this stack overflow response][shim]. [shim]: http://stackoverflow.com/questions/30443351/import-dependencies-in-ember-cli-e-g-import-math-js/30584671#30584671
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(function() { | ||
function vendorModule() { | ||
'use strict'; | ||
|
||
return { 'default': self['<%= name %>'] }; | ||
} | ||
|
||
define('<%= name %>', [], vendorModule); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/*jshint node:true*/ | ||
|
||
var stringUtil = require('ember-cli-string-utils'); | ||
|
||
module.exports = { | ||
description: 'Generates an ES6 module shim for global libraries.', | ||
|
||
locals: function(options) { | ||
var entity = options.entity; | ||
var rawName = entity.name; | ||
var name = stringUtil.dasherize(rawName); | ||
|
||
return { | ||
name: name, | ||
}; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters