Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Bootstrap Less to Sinatra

I have a Modular Sinatra app and I'm trying to add the Bootstrap less to the application.

get '/bootstrap/application.css' do
  less :"bootstrap/bootstrap"
end

I have all less files in views/bootstrap, including bootstrap.less.

I get this error:

 Less::ParseError at /bootstrap/application.css 'reset.less' wasn't found.

The first real line of Bootstrap.less is:

 // CSS Reset
 @import "reset.less";

I've tried all different path formats, but it never finds the files it's looking to import. Any idea how to make this work?

like image 615
user577808 Avatar asked Mar 13 '12 10:03

user577808


2 Answers

Have you tried passing the :paths config option?

get '/bootstrap/application.css' do
  less :"bootstrap/bootstrap", :paths => ["views/bootstrap"]
end

I've had problems with this option in the past but it may work for you.

like image 153
fatnic Avatar answered Oct 16 '22 02:10

fatnic


I found a solution that worked for me here: Parsing LESS options in a Sinatra app

Since this question was the one I found first on Google, I thought I'd leave the link here so that others can find it.

like image 31
egerlach Avatar answered Oct 16 '22 02:10

egerlach