在我的 Sinatra/Padrino 应用程序中我有
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
我想知道在哪里可以找到coffee 和scss 方法的定义。我想学习这个方法的源码
最佳答案
正如@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
关于ruby - 搜索coffee和scss方法的源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10696394/