使用sinatra和haml从新的sass格式(scss)生成css文件 [英] generating css file from new sass format (scss) with sinatra and haml

查看:97
本文介绍了使用sinatra和haml从新的sass格式(scss)生成css文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用haml和sass编写一个sinatra应用程序.当我尝试在样式表中链接带有位于我的views文件夹中的scss扩展名时,出现以下错误:/nav.css未定义方法`scss'的NoMethodError

I am writing a sinatra app with haml and sass. When I try to link in the stylesheet with a scss extension located in my views folder I get the following error: NoMethodError at /nav.css undefined method `scss'

这是我的get方法

get '/nav.css' do 
    content_type 'text/css', :charset => 'utf-8'
    scss :nav
end

当我切换到旧的sass语法时,我才开始使用它.我还必须将nav.scss更改为nav.sass,并将get方法更改为sass:nav

I have only gotten this to work when I switch to the older sass syntax. I also have to change the nav.scss to nav.sass and the get method to sass :nav

我也尝试过仅将sass:nav与nav.scss结合使用,并且将sass:nav与nav.sass结合使用,但是仍然使用scss语法

I have also tried just having sass :nav with nav.scss and sass :nav with nav.sass but still scss syntax

推荐答案

Sinatra的摘录自述文件

Excerpt from Sinatra README

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

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

您需要无礼的宝石吗?

您使用什么版本的Sinatra. 2010年9月1日添加了对scss的支持(同一天版本从1.0增加到1.1),也许您需要更新.

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.

这篇关于使用sinatra和haml从新的sass格式(scss)生成css文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆