-
-
Save villander/1aa82e9a1b9f060a19d908db9e7eda60 to your computer and use it in GitHub Desktop.
Ember-cli-es6-imports
This file contains hidden or 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
// install ember-cli-es6-transform | |
function importFromNPM(app,moduleName) { | |
let relPath = `node_modules/${moduleName}`; | |
let nodePath = `./${relPath}`; | |
let config = require(`${nodePath}/package.json`); | |
if (config.style) { | |
app.import(`${relPath}/${config.style}`); | |
} | |
app.import(`${relPath}/${config.module}`, { | |
using: [ | |
{ transformation: 'es6', as: config.name } | |
] | |
}) | |
} | |
//usage | |
/* | |
importFromNPM(app, 'cropperjs'); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment