Ruby 扩展中间人以处理新文件类型(.JADE)
我想补充一下。翡翠对中间商的支持。我不需要使用jade的任何动态功能,但我想在middleman中编译我的应用程序,而不是使用我自己的凌乱编译脚本Ruby 扩展中间人以处理新文件类型(.JADE),ruby,format,pug,middleman,Ruby,Format,Pug,Middleman,我想补充一下。翡翠对中间商的支持。我不需要使用jade的任何动态功能,但我想在middleman中编译我的应用程序,而不是使用我自己的凌乱编译脚本 向Middleman添加新文件类型的最简单方法是什么?Middleman的模板是建立在这个基础上的,因此使用gem应该非常简单 下面是一些用于向Middleman添加胡须模板的代码: require 'tilt-mustache' # Mustache Renderer module Middleman::Renderers::Mustache
向Middleman添加新文件类型的最简单方法是什么?Middleman的模板是建立在这个基础上的,因此使用gem应该非常简单 下面是一些用于向Middleman添加胡须模板的代码:
require 'tilt-mustache'
# Mustache Renderer
module Middleman::Renderers::Mustache
class << self
def registered(app)
# Mustache is not included in the default gems,
# but we'll support it if available.
begin
# Require Gem
require "mustache"
# After config, setup mustache partial paths
app.after_configuration do
Mustache.template_path = source_dir
# Convert data object into a hash for mustache
provides_metadata %r{\.mustache$} do |path|
{ :locals => { :data => data.to_h } }
end
end
rescue LoadError
end
end
alias :included :registered
end
end
Middleman::Base.register Middleman::Renderers::Mustache
需要“倾斜胡须”
#胡子渲染器
模块中间人::渲染器::胡须
类Middleman的模板是建立在上面的,所以使用gem应该非常简单
下面是一些用于向Middleman添加胡须模板的代码:
require 'tilt-mustache'
# Mustache Renderer
module Middleman::Renderers::Mustache
class << self
def registered(app)
# Mustache is not included in the default gems,
# but we'll support it if available.
begin
# Require Gem
require "mustache"
# After config, setup mustache partial paths
app.after_configuration do
Mustache.template_path = source_dir
# Convert data object into a hash for mustache
provides_metadata %r{\.mustache$} do |path|
{ :locals => { :data => data.to_h } }
end
end
rescue LoadError
end
end
alias :included :registered
end
end
Middleman::Base.register Middleman::Renderers::Mustache
需要“倾斜胡须”
#胡子渲染器
模块中间人::渲染器::胡须
班