Last active
December 21, 2015 08:28
-
-
Save hbsnow/6278193 to your computer and use it in GitHub Desktop.
jekyll で jekyll と compass のバージョンを取得する plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 使用している 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