Class: Jekyll::Converters::Minify::CSMinify
- Inherits:
-
CoffeeScript
- Object
- CoffeeScript
- Jekyll::Converters::Minify::CSMinify
- Defined in:
- lib/jekyll-jsminify.rb
Instance Method Summary collapse
- #convert(content) ⇒ Object
-
#initialize(config = {}) ⇒ CSMinify
constructor
A new instance of CSMinify.
- #matches(ext) ⇒ Object
- #output_ext(ext) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ CSMinify
Returns a new instance of CSMinify.
63 64 65 66 |
# File 'lib/jekyll-jsminify.rb', line 63 def initialize(config={}) config['jsminify'] = Minify::symbolize_keys(config['jsminify']) @config = config.dup end |
Instance Method Details
#convert(content) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/jekyll-jsminify.rb', line 76 def convert(content) config = @config['jsminify'] || {} # can't figure out why sometimes, CS comes down here, and sometimes, # proper JS. Also can't figure out how to scope to just SyntaxError. # some timing issue? begin return super if config[:do_not_compress] == true rescue return content if config[:do_not_compress] == true end begin Uglifier.new(config).compile super rescue Uglifier.new(config).compile content end end |
#matches(ext) ⇒ Object
68 69 70 |
# File 'lib/jekyll-jsminify.rb', line 68 def matches(ext) ext.downcase == ".coffee" end |
#output_ext(ext) ⇒ Object
72 73 74 |
# File 'lib/jekyll-jsminify.rb', line 72 def output_ext(ext) super end |