Created
November 22, 2016 22:27
-
-
Save fivetanley/3fd24d34d7709ed48d8266648cc6077f to your computer and use it in GitHub Desktop.
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
/* jshint node: true */ | |
'use strict'; | |
var path = require('path'); | |
var mergeTrees = require('broccoli-merge-trees'); | |
var babel = require('broccoli-babel-transpiler'); | |
var lodashPlugin = require('babel-plugin-lodash'); | |
module.exports = { | |
name: 'lodash', | |
setupPreprocessorRegistry: function(type, registry) { | |
var addon = this; | |
registry.add('js', { | |
name: 'ember-lodash', | |
ext: 'js', | |
toTree: function(tree) { | |
return babel(tree, { plugins: [ lodashPlugin ] }); | |
} | |
}); | |
}, | |
treeForAddon: function(tree) { | |
var lodashPath = path.dirname(require.resolve('lodash-es/lodash.js')); | |
var lodashTree = this.treeGenerator(lodashPath); | |
var trees = mergeTrees([lodashTree, tree], { | |
overwrite: true | |
}); | |
return this._super.treeForAddon.call(this, trees); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment