metaskills / less-rails-bootstrap

The most popular front-end framework for developing responsive, mobile first projects on the web for Rails asset pipeline.
561 stars 128 forks source link

Cannot precompile assets, only works in development environment #4

Closed erikdahlstrand closed 12 years ago

erikdahlstrand commented 12 years ago

Hi,

Can you precompile the assets? In a vanilla app with empty stylesheets (just less-rails-bootstrap in my Gemfile) I get...

bundle exec rake assets:precompile
rake aborted!
file 'reset.less' wasn't found.

(in /Users/erdah/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/less-rails-bootstrap-1.3.2/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.less)
metaskills commented 12 years ago

Whoa, that's not good. What does your top level asset manifest (maybe application.css) or sub asset file (maybe foo.less.css) look like?

erikdahlstrand commented 12 years ago

I have application.css.less .

//= require twitter/bootstrap
//= require_self

#my-styles { }

I get this error message also with a completely empty css file (without require twitter/bootstrap).

metaskills commented 12 years ago

This is one reason I wanted to get the combustion project in for testing this engine and making sure it all work. Will do that for this fix.

https://github.com/freelancing-god/combustion

metaskills commented 12 years ago

FYI, but I won't be able to get to this for a while, so if someone makes a pull request before I do, I'll take it.

walski commented 12 years ago

I've figured that out and it is a strange combination of a few different things. First I've had to change the path that is added to the app.config.less.path array to: 'vendor/assets/stylesheets/twitter' in engine.rb (I've included that in a pull request regarding Rails 3.1.1 initializer grouping).

But I also had to change something in less-rails which is the dirtiest hack I've done in a long time, so I won't send a pull request for that but maybe it helps people to get going in the meantime: You've to open the template_handlers.rb file of the less-rails gem and copy the whole LessTemplate class to a new class named Tilt::LessTemplate. So that you practically overwriting the original LessTemplate class of the Tilt gem. The normal precompilation process didn't use the provided class, even as it is added as an engine in the railtie.rb. Don't know why, though :/

Hope this helps a little to get up to speed again.

erikdahlstrand commented 12 years ago

@walski Awesome Thorben!

metaskills commented 12 years ago

Gonna close this out and deal with it under ticket #7

metaskills commented 12 years ago

FYI, should be solved by using the latest less-rails, less-rails-bootstrap and rails 3.1.1 But please test and let me know under that ticket #7