How to specify custom Sass directory with sinatra

Posted by yaya3 on Stack Overflow See other posts from Stack Overflow or by yaya3
Published on 2010-05-28T00:55:30Z Indexed on 2010/05/28 1:01 UTC
Read the original article Hit count: 387

Filed under:
|
|
|
|

Instead of serving my Sass files from the default 'views' directory I'd like to change this to /assets/sass

The following attempts are in my main ruby root file in the app:

Attempt 1

set :sass, Proc.new { File.join(root, "assets/sass") }

get '/stylesheet.css' do
    sass :core
end

With this I get the following error:

 myapp.rb:17 NoMethodError: undefined method `merge' for "/Users/x/x/x/mysinatraapp/assets/sass":String

Attempt 2

get '/stylesheet.css' do
    sass :'/assets/sass/core'
end

Attempt 3

get '/stylesheet.css' do
    sass :'/assets/sass/core'
end

Both return the following error:

Errno::ENOENT: No such file or directory - ./views/assets/sass/core.sass

Attempt 4

get '/stylesheet.css' do
    sass :'../assets/sass/core'
end

This works! however, there must be something along the lines of set :sass, Proc.new { File.join(root, "assets/sass") } that sets this up for me?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about routing