Ask A Question

Notifications

You’re not receiving notifications from this thread.

Manage Assets With Rails Assets Discussion

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. :)

Reply
Jamie Barton Jamie Barton

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

Reply

Great sample thanks!

Reply

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

Reply

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

Reply

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

Reply

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

Reply

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"): ........

Reply

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.

Reply

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?

Reply

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.

Reply
Mohnish Jadwani Mohnish Jadwani

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( http://www.cybrilla.com/blo... ) on how one could find runtime dependencies for the gems they'd like to use via Rails assets.

Reply

Awesome post! Thanks for sharing that Mohnish.

Reply

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!

Reply

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

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

Reply

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?

Reply

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?

Reply

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 https://github.com/torba-rb.... Please, check it out.

Reply

great video, thanks!

Reply

greatwork Chris

Reply

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

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 81,842+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.