我正在尝试从SASS文件创建一个CSS文件。
一开始我试着这么做。
sass_filename = "#{Rails.root}/app/assets/stylesheets/application.sass"
css = Sass::Engine.for_file(sass_filename).render
File.open("#{render_path}/stylesheets/application.css", "wb") {|f| f.write(css) }我在Sass::Engine.for_file()上遇到了错误wrong number of arguments (1 for 2),因为I didn't put anything for options field。
我不确定如何设置选项字段。
我试过了
css = Sass::Engine.for_file(sass_filename, :syntax => :sass).render
但是对于nil:NilClass`错误,我得到了undefined method[]‘。
如何设置将SASS转换为CSS的默认选项?
发布于 2012-09-27 08:48:09
如果您没有传递任何选项,请尝试对选项使用空散列,例如'{}‘:
sass_filename = "#{Rails.root}/app/assets/stylesheets/application.sass"
css = Sass::Engine.for_file(sass_filename, {}).render
File.open("#{render_path}/stylesheets/application.css", "wb") {|f| f.write(css) }https://stackoverflow.com/questions/12612430
复制相似问题