Skip to content

Instantly share code, notes, and snippets.

@hbsnow
Last active December 21, 2015 08:28
Show Gist options
  • Select an option

  • Save hbsnow/6278193 to your computer and use it in GitHub Desktop.

Select an option

Save hbsnow/6278193 to your computer and use it in GitHub Desktop.
jekyll で jekyll と compass のバージョンを取得する plugin
# 使用している jekyll, compass のバージョンを取得する plugin
# {% varsion markup %}
# @markup jekyll, compass
require 'rubygems'
require 'compass'
module Jekyll
class VersionTag < Liquid::Tag
def initialize(tag_name, markup, tokens)
@markup = markup.strip.downcase.delete '"\''
end
def render(context)
case @markup
when 'jekyll' then "#{Jekyll::VERSION}"
when 'compass' then "#{Gem.loaded_specs['compass'].version.to_s}"
else 'error!'
end
end
end
end
Liquid::Template.register_tag('version', Jekyll::VersionTag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment