rharriso / bower-rails

Bundler-like DSL + rake tasks for Bower on Rails
MIT License
1.46k stars 128 forks source link

Handling assets (relative paths, fonts) correctly #83

Closed jmuheim closed 10 years ago

jmuheim commented 10 years ago

Hello!

I really appreciate bower-rails, but so far it seems to be only useful for js-only packages.

I tried to get Bootstrap to work, and while figuring out how to integrate it correctly into my development process, it doesn't work for production, as there are some issues with relative paths and other assets (like e.g. fonts), as you may already know.

Are you interested in some help fixing these? I'm thinking of two things:

1) Fix the relative assets problem. I think this shouldn't be a big problem, as resolve_asset_paths looks pretty simple. Instead of converting the .css file into a .css.erb file I suggest replacing all file paths directly and saving the file as normal .css file.

2) Copy additional assets to public/assets. This should be possible, too. I don't really know where's specified which files should be available for use (I could imagine that it's the main directive), but then we could simply copy the files to the Rails public/assets directory.

SergeyKishenin commented 10 years ago

Yes! Any help is appreciated. But there are some points that I'd like to clarify.

1) Should we try to find out why sprockets is not seeing css.erb files under vendor/assets/bower_components even we confiure extensions at application.rb with config.assets.precompile << ['*.js', '*.css', '*.css.erb'] (ref)? Is it spread only on app/assets dir? But we have bower_components in assets.paths. Should we try to open a sprockets-rails issue maybe?

2) I don't find it the best idea to copy files to public/assets. There is already the issue opened that says that this case can be handled with config.assets.precompile.

If we follow the link to Rails' pull and see files we should notice that vendor and lib dirs should be included by hand.

So does it mean we should just configure sprockets properly?

jmuheim commented 10 years ago

I'll take a further look into the mentioned topics soon. Gotta go now. TTYL.

jmuheim commented 10 years ago

@SergeyKishenin, I decided to stick with rails-assets.org. It feels more natural to be able to simply do a //= require bootstrap-formhelpers instead of manually having to find the correct files to require, etc. Also it's cooler to only edit one file for both gems and assets, compared to having another Bowerfile file.

I read somewhere that you are planning to join forces with rails-assets.org? I wish both projects big success, having a working solution for assets management is highly anticipated by the Rails community and long overdue.

Thank you for your work!

SergeyKishenin commented 10 years ago

Yes, we are! But now the development is stopped because of lack of time :( Hope, we'll get back to it asap.