我试图在我的SCSS文件中加载CSS3和重置模块,但在尝试导入任何特定于指南针的模块时遇到错误。
Sinatra App:
require 'rubygems'
require 'sinatra'
require 'sass'
require 'compass'
configure do
set :scss, {:style => :compact, :debug_info => false}
Compass.add_project_configuration(File.join(Sinatra::Application.root, 'config', 'compass.rb'))
end
get '/css/:name.css' do
content_type 'text/css', :charset => 'utf-8'
scss(:"stylesheets/#{params[:name]}" )
endstyle.scss:
@import "compass/reset";
@import "compass/css3";错误消息:
Sass::SyntaxError at /css/style.css
File to import not found or unreadable: compass/reset. Load path: /Users/work/repos/mysite有没有可以安装的gem来自动拉出这些模块,或者必须将Compass文件移动到Sinatra应用程序中?
发布于 2012-05-27 13:13:41
在您的compass.rb中完成正确的配置后,通常足以添加以下内容:
get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8'
sass params[:name].to_sym, Compass.sass_engine_options
end到你的路线。Sinatra Integration、Sample project或您可能认为有用的东西:Better Compass integration for Sinatra (extracted from BigBand)
在模块化的Modular App中,我使用类似于:
module Assets
# #Sass/Compass Handler
class Stylesheets < Sinatra::Base
register CompassInitializer
get '/stylesheets/:name.css' do
content_type 'text/css', :charset => 'utf-8'
sass params[:name].to_sym, Compass.sass_engine_options
end
end
end我的lib文件夹中有一个文件compass_plugin.rb
module CompassInitializer
def self.registered(app)
require 'sass/plugin/rack'
Compass.configuration do |config|
config.project_path = Padrino.root
config.sass_dir = "app/stylesheets"
config.project_type = :stand_alone
config.http_path = "/"
config.css_dir = "public/stylesheets"
config.images_dir = "public/images"
config.javascripts_dir = "public/javascripts"
config.output_style = :compressed
end
Compass.configure_sass_plugin!
Compass.handle_configuration_change!
app.use Sass::Plugin::Rack
end
end它是无耻地从Padrino框架中窃取的
发布于 2012-05-27 13:16:05
我觉得你应该:
$ gem install compass
$ compass createhttps://stackoverflow.com/questions/10771059
复制相似问题