vigetlabs / gulp-rails-pipeline

Ditch the Rails Asset Pipeline and roll your own with Gulp
MIT License
646 stars 62 forks source link

Serving assets from CDN #9

Open rymohr opened 9 years ago

rymohr commented 9 years ago

Is it possible to precompile assets and serve them from a CDN instead? I've been using asset_sync with the default rails pipeline and it's been working great.

greypants commented 9 years ago

Yeah, definitely possible. I haven't done it yet personally, but here are some resources to get you started.

This option in rev-collector https://www.npmjs.com/package/gulp-rev-collector#dirreplacements should let you get your cdn path in there. There are other gulp plugins for uploading. Here are a couple for publishing to amazon web services:

https://www.npmjs.com/package/gulp-s3-upload https://www.npmjs.com/package/gulp-awspublish

rymohr commented 9 years ago

As is the project completely ignores asset_host though right?

greypants commented 9 years ago

Yeah, none of the tasks know about Ruby or Rails.

joaovpmamede commented 9 years ago

@rymohr Did you find a way of getting the assets from a CDN? From what I get rev-collector only changes files from html templates but we probably need to get other assets referenced on css also.

rymohr commented 9 years ago

@joaovpmamede I haven't actually tried to use this one yet. The project I was hoping to use it for is a production app with 50k lines of js so it won't be an easy migration. Waiting till it's been battle tested a bit more.