-
-
Save tomraithel/4064960 to your computer and use it in GitHub Desktop.
JEKYLL: Coffeescript converter plugin
This file contains 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
# Put this file in '_plugins/' and write a YAML header to your .coffee files (i.e. "---\n---\n") | |
module Jekyll | |
require 'coffee-script' | |
class CoffeeScriptConverter < Converter | |
safe true | |
priority :normal | |
def matches(ext) | |
ext =~ /coffee/i | |
end | |
def output_ext(ext) | |
".js" | |
end | |
def convert(content) | |
begin | |
CoffeeScript.compile content | |
rescue StandardError => e | |
puts "CoffeeScript error:" + e.message | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment