I am used to bower and importing the lodash.min.js in index.html from bower_components/ folder. However since bower is deprecated I would like to use the distribution from npm instead but I see no easy way of including lodash.min.js from node_modules without copying it into the www folder and importing it from there…
Is that really the best way or do I need some kind of build system, i.e. gulp, for fetching these files and including them in my app project?
I’m using Lodash in my ionic v1 project now, and I’d like to share my way with you.
I feel that you don’t need to make an extra use of build system.
First, include the lodash.min.js in your index.html.
angular.module('app', [])
...
// Make lodash working in controllers
.constant('_', window._)
.run(function($rootScope) {
// Make lodash working in views
$rootScope._ = window._;
});
Hello again! Yes, that would work but I am not talking about using a depdency with bower, but with NPM and no build system. Maybe this is not possible after all.