Skip to main content

Manage Assets With Rails Assets Discussion

General • Asked by Chris Oliver

Love rails assets. I first found out about it about a year ago, and it quickly became one of my favorite ways to grab front end libs. :)

I found it only a few weeks ago. I love how easy it is to use. Absolutely brilliant.

It's really, really well done. Props to the authors!

I have many app using asset as regular mode and this the first time hear about rails asset. Thanks for that. I'm going definitely change to this

I'm definitely migrating over some older apps too! :)

Great Stuff Chris... This is definitely a better way to add frontend libs. One more tool for the toolchain....

So awesome! I was using bower-rails and was not aware of this option. Thanks so much for sharing Chris!

That's awesome, Thank you Chris I never thought a such thing exists... But does this work for all libraries ? after watching the video I tried rails-assets-ckeditor but it seems that I am getting errors like ActionController::RoutingError (No route matches [GET] "/lang/en.js"): ........

It should, but with more complex things like ckeditor, you might have to have those lang/en.js files compiled separately. Something like this based upon the filename in the Rails Assets gem.

config.assets.precompile += %w( lang/en.js )

This is definitely one part where the documentation with Rails Assets is poor.

Hi I am trying Rails Assets but I approach to a problem. I included Bourbon but when I tried use any mixin Rails told me that mixin is undefined. What to do?

If you haven't tried this already, you'll probably want to include bourbon with @import instead of the require statements so you can use it in your sass code.

Thanks for sharing a screencast on this Chris. Recently we used the same thing in one of our client projects. As a first timer to it back then, I found it a little difficult to figure out where could I find runtime dependencies to the gems I'd like to use from the Rails Assets site. I've written a blog( ) on how one could find runtime dependencies for the gems they'd like to use via Rails assets.

Awesome post! Thanks for sharing that Mohnish.

Thanks for the encouragement Chris. Really glad you found it useful :)

Great video. I experimented by switching out my bootstrap-sass gem. The one thing I'm not understanding, is how do you tell rails-assets the version constraints you would like to stay within like the convention with rubygems? Thx!

I believe it works by just setting the version on the gem you include.

gem "rails-assets-bootstrap", "1.0.0"

Thanks for the quick response Chris. I'm assuming that if an explicit version is not specified, rails-assets will take the latest available version then... correct? Love the videos!

You are correct. It'll use that latest version of the library. And thanks! :D

Hey Chris - how are custom styles handled? Do we simply place them into the application.css file? Or are we required to build a separate customization file?

If you're trying to customize something like bootstrap, you can do this: Instead of doing the *= require bootstrap, you can do @import "bootstrap" to import the file using SASS and put your custom variables above the import to override the defaults.

Basically it doesn't change from how you would normally do it, but it can be a little unclear since they don't give you any instructions. Does that make sense though?

Yep, that makes total sense. Thanks for clarifying that for me Chris!

I often had kind of feeling that using bower and rubygems for such simple task as fetching vendor assets is too much overhead. So I wrote Please, check it out.

Awesome Awesomer Awesomesttttt! I was using bower-rails and was not aware of this option. Thanks so much for sharing Chris!

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.