1

I'm building an application with Padrino, and I've decided to use less for the stylesheet, mostly to use twitter bootstrap.

I am having some trouble getting less to automatically compile my less files when serving the app via pow.

When I run padrino start and use the embedded server, I get nice styling, but I don't really understand how. The application.css file that is generated is exactly how it should be, except there are no changes to the application.css file in my app's public dir.

When I run the app through pow, though, no changes made to the application.less file are reflected on the application.css file, which is the only one served.

I'm mostly trying to understand how and why less is only compiled when running webrick.

My less initializer is:

module LessInitializer
  def self.registered(app)
    # Enables support for Less template reloading for rack.
    # Store Less files by default within 'app/stylesheets/'
    # See http://github.com/kelredd/rack-less for more details.
    require 'rack/less'
    # optional - use as necessary
    Rack::Less.configure do |config|
      config.compress = true
      config.cache = true
      # other configs ...
    end
    app.use Rack::Less,
      :root      => Padrino.root,
      :source    => 'app/stylesheets',
      :public    => 'public',
      :hosted_at => 'stylesheets'

  end
end

And my application.less file is:

@import "bootstrap/bootstrap.less";

body {
    padding-top: 60px;
    padding-bottom: 40px;
}

.sidebar-nav {
    padding: 9px 0;
}
Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Pedro Vanzella
  • 1,235
  • 1
  • 8
  • 13

1 Answers1

0

I've just tried this with Padrino edge and Pow and it's working alright.

To be honest, it shouldn't really make a difference whether it's Pow or Webrick - as long as it's rack complaint it should just work.

You can try changing padrino's gem on your test project to point to:

gem 'padrino', :git => 'git://github.com/padrino/padrino-framework.git'

There's currently an unmet dependency for less on edge but it should be merged soon. So if the above didn't work, use this:

gem 'padrino', :git => 'git://github.com/padrino/padrino-framework.git', :branch => 'fix-less-dependencies'

If you keep on having a problem, would you mind opening an issue on Github?

Thanks!