shalicke / sinatra-stagehand

Sinatra + Bootstrap, Bower, jQuery, Haml, Sass, Asset Pipeline, DataMapper. Just a convenient setup, really. Do what you will!
6 stars 3 forks source link

Best way to integrate sinatra-sprockets helpers? #1

Open jfrux opened 11 years ago

shalicke commented 11 years ago

This could be cleaned up, so I'll get on that.

What I'm doing is installing components with bower:

bower install d3 cubism

then adding those paths to config.ru:


map '/assets' do
  environment = Sprockets::Environment.new
  environment.append_path 'components/jquery'
  environment.append_path 'components/d3'
  environment.append_path 'components/cubism'
  environment.append_path 'components/bootstrap/bootstrap/'
  environment.append_path 'assets'
  run environment
end
// application.css
//= require css/bootstrap.min
//= require_tree .
// application.js
//= require jquery
//= require d3.min
//= require cubism.v1
//= require_tree .

I use require_tree to keep site_specific assets in the css and js dirs, e.g. a site.js gets included automatically, or it is good for dropping in quick javascript tests. It's quite a bit of flexibility.

shalicke commented 11 years ago

...and then I realized I am answering the wrong question. I had no idea there was a sinatra-sprockets gem. It's late. :clock1:

I'll look into this.