Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 扩展中间人以处理新文件类型(.JADE)_Ruby_Format_Pug_Middleman - Fatal编程技术网

Ruby 扩展中间人以处理新文件类型(.JADE)

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

我想补充一下。翡翠对中间商的支持。我不需要使用jade的任何动态功能,但我想在middleman中编译我的应用程序,而不是使用我自己的凌乱编译脚本


向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
需要“倾斜胡须”
#胡子渲染器
模块中间人::渲染器::胡须
班