componentjs / component

frontend package manager and build tool for modular web applications
https://github.com/componentjs/guide
MIT License
4.55k stars 305 forks source link

integration with angularjs suggestions? #192

Closed jasonkuhrt closed 11 years ago

jasonkuhrt commented 11 years ago

Does anyone have a good workflow for how components would be used from within angularjs? If anyone is doing this or thought of it, I would be curious to hear about their process...

tj commented 11 years ago

the best you could do really is wrap your entire app as one component, so that require()s all resolve etc. That's the thing about global vars, they just kinda, suck in general, no way around that really, or you could require() at the root level like require('component-tip') etc but then you have the prefixes

jasonkuhrt commented 11 years ago

The global require can be solved by using angularjs inside brunch.

@visionmedia But how does the component build process elegantly work within brunch? Brunch can concatenate all my files in the app etc. I don't really need/want components build step?

tj commented 11 years ago

github.com/component/builder.js

tj commented 11 years ago

not sure what brunch does tho so im no help there, but it could use builder to add this to its build step

jasonkuhrt commented 11 years ago

@visionmedia I'm aware of it but the Readme leaves me somewhat confused of its full power. I will just give it a go in brunch and see if I can create a coherent seed repo. I will report back into this issue (even if it just became closed =)) with problems I encounter

jasonkuhrt commented 11 years ago

@visionmedia Brunch is an application assembler like the new yeoman project. It creates a platform for common app build patterns (i.e. brunch can transpile languages, minify, lint, wrap all files in commonjs, etc.)

tj commented 11 years ago

I see, yeoman doesn't make any sense to me but fair enough! if you need an example component-build(1) is what uses the builder

jasonkuhrt commented 11 years ago

@visionmedia I guess you feel that instead of using an application assembler you could just roll your own build process via make? That's fair enough too, but in practice I've wasted time trying to manage transpiling each language in an app (typically LiveScript, Jade, Stylus), and creating a pleasant build step. Maybe some people like grunt, not me.

tj commented 11 years ago

or just use the builder, using the builder or make would be as simple as https://github.com/component/todo/blob/master/server/build.js

grunt is lame too, the builder will facilitate compilation in the near future, things like .coffee files etc will "just work", not out of the box, because there's a silly number of them but we'll facilitate that sort of logic

jasonkuhrt commented 11 years ago

Interesting.... so eventually component-builder is going to become an application assembler, or not at all? I.e. in the compile step can arbitrary things be done, appropriate for building an application? Will generators be supported? etc.

tj commented 11 years ago

it's going to allow you to take your app components and do whatever you want with them, auto-compile templates etc, no generators or anything like that, it's not some boilerplate thing, just hooks for app-level integration, not a lint runner etc, that's what Make and friends are for

jasonkuhrt commented 11 years ago

@visionmedia thanks for explaining a little.

What's your take on angularjs (directives especially) and meteorjs? The angjs guys and metjs guys have said they are talking to one another to make their projects play excellent together. I love the commonjs and focused nature of components, I love the database concept and deployment story of meteor, and I love directives. Kind of sucks that none of the 3 play well together =\

I guess that's the whole concept of component: start making stuff play well together!!!

jasonkuhrt commented 11 years ago

@visionmedia another question: is components the right avenue for sharing stylus modules? ...

tj commented 11 years ago

what are these directive things? I'm not familiar, but yea you're right, component is more of a platform, things like meteor / angularjs could be comprised of components in the future. In a lot of ways neither project makes sense really, why they're so coupled, who knows

jasonkuhrt commented 11 years ago

@visionmedia It would be best if you spend a half-hour learning about directives yourself (better than me trying to half-ass explain it). Start here? http://angularjs.org/ (see last example).

But basically directives allow users to extend html to create new tags or attributes, and have them do anything, and have multiple new tags and/or attributes interact with one another in anyway. You create DSLs for your app, and you make creating apps a declarative process? etc...

If you google it there's lots and lots out there. I think you'll not-like it, but it would be useful for you to learn about I think... (project ideas, technical ideas, etc.)

In general angularjs basically puts a compiler in the client.

tj commented 11 years ago

oh I see, yeah I mean you could do that with anything really, doesn't have anything to do with angular you could write a component to do the same easily instead of bloatware.