Angular 2 and Rails 5, asset pipeline or no?

984 views
Skip to first unread message

Amrit Kahlon

unread,
Dec 23, 2015, 2:19:09 PM12/23/15
to AngularJS
What is the best way to set up a project using angular 2 and rails 5? I was using it with angular 1.5 and typescript before, and had the asset pipeline setup with the typescript rails gem. It all seemed to work fine. 

Now I'm not quite sure how this systemjs works, or how to use angular 2 without it. What I'm looking for is all of my angular code somewhere in the repo, compiling the files into the public folder un-concatenated. Would this be the best way to do it? Another way I was thinking was have a development server running as well in a different folder, work on it as two separate apps, then when it comes time to production, minify all the files (but not concatenate them) and serve them up in the public folder. 

Vincent Zhu

unread,
Jan 1, 2016, 8:55:38 PM1/1/16
to AngularJS
Hi, Amrit
I was there.
My solution is using npm + tsc + watchify, you will need to write the js code in TS, tsc into js, then use watchify to bundle required npm modules.

Amrit Kahlon

unread,
Jan 1, 2016, 9:10:54 PM1/1/16
to ang...@googlegroups.com

Yep that's what I ended up doing, except with gulp.

Cheers

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/OWKC-ukgsx8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Vincent Zhu

unread,
Jan 1, 2016, 9:31:51 PM1/1/16
to AngularJS
Cool, share some my confusions with you. ;-)
how do you use template if not using gulp?  simply inline template? 
Also, how do you handle the rails asset pipeline? like do you use asset_path ?

Amrit Kahlon

unread,
Jan 4, 2016, 2:50:09 PM1/4/16
to AngularJS
Not quite, I load them in on compilation.

See this answer: 

I also wrote this gulp plugin to load the sass as well:

Amrit Kahlon

unread,
Jan 4, 2016, 2:50:52 PM1/4/16
to AngularJS
At this point I'm completely ignoring the rails asset pipeline.


On Friday, January 1, 2016 at 6:31:51 PM UTC-8, Vincent Zhu wrote:
Reply all
Reply to author
Forward
0 new messages