How to specify custom Sass directory with sinatra
- by yaya3
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?