scotch / angular-brunch-seed

AngularJS + Brunch
Other
228 stars 78 forks source link

Bower integration + Jade to AngularJS modules compiler #43

Closed GulinSS closed 11 years ago

GulinSS commented 11 years ago

Don't forget to

npm install -g bower
bower install
kylefinley commented 11 years ago

Wow this great! I noticed your conversation here. So is this just a temporary fix until Brunch has core Bower support? I'm excited to incorporated a client-side package manager, but I want to make sure that were are not switching the api to much. Would you mind maintaining a fork until the implementation has settled? I can added it to the README.

GulinSS commented 11 years ago

Yes, it is the temporary fix, but users such as you and me can try this feature on taste already. It helps @paulmillr to determine what we want as users of Brunch. I don't think API will be modified so much, cause I solved my problems and was satisfied. Only bug fixing.

I use it in my working project, so I can maintain this packages.

Note the https://github.com/GulinSS/jade-angularjs-brunch. This tool is usefull for speed up UI response.

N.B. Bower packages has dirty specification for package descriptor file. This is a pain. Thats why we need additional instructions in config.coffee to determine what is what in a Bower package. But Bower as a tool can solve problem with downloading and upgrading.

My next task is write documentation for these packages. My english is poor and I think this task will be tricky for me. :-)

kylefinley commented 11 years ago

Yes, it is the temporary fix, but users such as you and me can try this feature on taste already. It helps @paulmillr to determine what we want as users of Brunch. I don't think API will be modified so much, cause I solved my problems and was satisfied. Only bug fixing.

I use it in my working project, so I can maintain this packages.

Excellent, I've added a link to your repo in the README. That way interested users can test out Bower support, and once Brunch adds core support for Bower, we can merge the changes back into this this branch.

Note the https://github.com/GulinSS/jade-angularjs-brunch. This tool is usefull for speed up UI response.

This looks interesting. So this converts the jade files to javascript? So the benefit is that it preloads the templates, but the downside is that the initial load time would increase, is that right?

N.B. Bower packages has dirty specification for package descriptor file. This is a pain. Thats why we need additional instructions in config.coffee to determine what is what in a Bower package. But Bower as a tool can solve problem with downloading and upgrading.

This brings up an interesting question. Do you think that Bower should be used instead of component? It seems that component support will be coming to Brunch soon.

My next task is write documentation for these packages. My english is poor and I think this task will be tricky for me. :-)

Your English seems good to me :) Just use a lot of code examples, that's the language we all understand

paulmillr commented 11 years ago

I’ve been investigating whether component(1) or bower should make their way into brunch since their initial releases.

At this point, as @GulinSS said, bower has shitty support for builders. Something that requires manual addition to config.coffee every time would be feeling crappy in core of highly automated builder like brunch (but works fine for stuff like grunt which requires users to write 400-LOC configs). As I understand, bower plans to change this by introducing similar to component package config param.

The problem with component though that its usage will constrain brunchers to use different require('module') format. For example, simple require 'views/posts/post' won’t probably work, you will need to use relative paths instead. This means no backwards compatibility. But i’m not sure on this, component can wrap stuff into closures and make modules independent etc.

I experimented with component support in topics/component branch of brunch-with-chaplin (with topics/component version of brunch).

Overall I suggest @kylefinley to merge this PR and see how it would work in “real world”.

GulinSS commented 11 years ago

This looks interesting. So this converts the jade files to javascript? So the benefit is that it preloads the templates, but the downside is that the initial load time would increase, is that right?

Yes, this tool converts Jade files to javascript AgnularJS modules. Initial load time will be increased, and ng-cloak is your friend, thats right.

kylefinley commented 11 years ago

@paulmillr

Thank you for the input. Based on your response and after looking into component more, I can see that Bower's approach will be a better fit with angular.module() (we're not using require statement).

@GulinSS I've merged your PR into this feature branch feature/bower. I'll work on this weekend. I'll probably wait on adding jade-angular-brunch support. I think for larger applications lazy loading the partials makes sense. Once I dig into the code, I'll be in a better position to make a judgement, though.

I'll update this issue once I merge into master.

@paulmillr @GulinSS, Thank you both for all of your work.

vendethiel commented 11 years ago

The problem with component though that its usage will constrain brunchers to use different require('module') format. For example, simple require 'views/posts/post' won’t probably work, you will need to use relative paths instead. This means no backwards compatibility. But i’m not sure on this, component can wrap stuff into closures and make modules independent etc.

Yet it should be possible to remove their require() declaration (and just use brunch's one), and make brunch search in /deps/ too, no ?

paulmillr commented 11 years ago

@Nami-Doc I don’t know, ain’t managed to get your idea done. Would be great to see working implementation.

vendethiel commented 11 years ago

No idea how to automate that (require def removal) + auto-aliasing deps to '/deps' (instead of 'brunchproj/deps/...').

kylefinley commented 11 years ago

I finally merged this in.

A couple of notes:

  1. I think that bower-asserts-brunch should be renamed to bower- assets -brunch
  2. What does everyone think about using the vendor directory for components? Will that interfere with Brunch's normal operations? I added vendor to .gitignore, because bower adds a lot fo files we really don't need to track. I wonder if it wouldn't be better to use the components directory, though.

@GulinSS Thankyou for taking the time to put all of this together.

paulmillr commented 11 years ago

I think it would be more reasonable to use components directory.

vendethiel commented 11 years ago

Or bower/.

kylefinley commented 11 years ago

Ok, I've created a branch for this release/component. For some reason I can't get brunch to compile the js/components.js file, however. I don't know if something isn't configured correctly, or if vendor is hard coded somewhere. I'm not seeing errors. Any ideas?

GulinSS commented 11 years ago

For some reason I can't get brunch to compile the js/components.js file

That is why I use vendor directory.

I think that bower-asserts-brunch should be renamed to bower- assets -brunch

You are right.

kylefinley commented 11 years ago

@GulinSS Interesting. I've created issue #50 for switching vendor to components I'll look into this when I have more time.