generating css file from new sass format (scss) with sinatra and haml

瘦欲@ 提交于 2019-12-04 06:56:24

Excerpt from Sinatra README

## You'll need to require haml or sass in your app
require 'sass'

get '/stylesheet.css' do
  scss :stylesheet
end

Are you required the sass gem?

What version of Sinatra you use. Support for scss was added in 2010.09.01 (same day version was increased from 1.0 to 1.1), perhaps you need and update.

I don't use the above code from the README, just put the following in your app.rb file after updating your gem.

get '/stylesheets/:name.css' do
 content_type 'text/css', :charset => 'utf-8'
 scss(:"stylesheets/#{params[:name]}")
end

Restart your server and you're all set. Happy Scssing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!