在我的Sinatra / Padrino App中我有
require 'sass'
require 'coffee-script'
# Routes to COFFEE-JS and SCSS-CSS
get '/javascripts/:name.js' do
content_type 'text/javascript', charset: 'utf-8'
coffee :"../../public/javascripts/coffee/#{params[:name]}"
end
get '/stylesheets/:name.css' do
content_type 'text/css', charset: 'utf-8'
scss :"../../public/stylesheets/scss/#{params[:name]}"
end
我想知道,在哪里可以找到方法咖啡和 scss 的定义。我想学习这种方法的源代码
答案 0 :(得分:1)
正如@hugo所说,你可以(我以咖啡为例)从这里开始:
https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L628
然后:
https://github.com/rtomayko/tilt/blob/master/lib/tilt/coffee.rb#L45
最后:
https://github.com/rtomayko/tilt/blob/master/lib/tilt/coffee.rb#L45
https://github.com/sstephenson/execjs/blob/master/lib/execjs/runtime.rb#L43
取决于您的js运行时:
https://github.com/sstephenson/execjs/blob/master/lib/execjs/external_runtime.rb#L46
答案 1 :(得分:0)
通常,gem作者会在rubygems主页中放置指向源代码的链接
https://rubygems.org/gems/<gem_name>
对于您提到的宝石,可以找到来源
https://github.com/josh/ruby-coffee-script
和