wtfribley / angular-treemendous

Simple, flexible angular tree with grouping.
MIT License
6 stars 0 forks source link

Browserify compatibility #2

Open paulpflug opened 9 years ago

paulpflug commented 9 years ago
treemendous = require("angular-treemendous")
angular.module("app", [treemendous])

would be wonderful ;)

just add a index.js with

require('./angular-treemendous');
module.exports = 'treemendous';

and set the main in package.json to index.js

I can make a pr if you want

wtfribley commented 9 years ago

This component is already compatible with browserify:

require('angular-treemendous');
angular.module('app', ['treemendous']);

There's no need to expose the name of the component as a string.

What I can fix is the 'main' property of bower.json - I must have never updated it when I changed the name of the component. That should solve this issue.

wtfribley commented 9 years ago

@paulpflug can you verify that the latest version (0.2.4) works for you as recommended above? If so, I'll close this issue.

paulpflug commented 9 years ago

yeah works, the difference between the two is, the first one will be minified. I think it is the recommended version from browserify. but maybe thats not too important ;)

wtfribley commented 9 years ago

I'm not sure how this difference would affect minification, but I have been taking a look around at other angular packages and it seems like this method is in wide use... it just feels weird to me to export a string, rather than the module itself. Something like:

module.exports = angular.module('treemendous', ['ngAnimate'])
var myApp = angular.module('myApp', [
  require('angular-treemendous').name
]);

But I'm still debating this... gonna do some research and then implement something better than what I have now. I also need to update dependencies and such - this project requires some general upkeep.

paulpflug commented 9 years ago

I read about it at https://github.com/angular/angular.js/pull/10732

For me it is very convincing ;)

wtfribley commented 9 years ago

Oh, awesome - this is exactly the discussion I was looking for!

Will update accordingly.