Class: ProcessIt::JsMinTemplate
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- ProcessIt::JsMinTemplate
- Defined in:
- lib/processit/processor/jsmin_template.rb
Overview
Tilt engine class for the JSMin compiler. Depends on the ‘jsmin` gem.
For more infomation see:
Class Method Summary collapse
-
.engine_initialized? ⇒ Boolean
Check to see if JSMin is loaded.
Instance Method Summary collapse
-
#evaluate(scope, locals, &block) ⇒ Object
Compile template data with JSMin compiler.
-
#initialize_engine ⇒ Object
Autoload jsmin library.
- #prepare ⇒ Object
Class Method Details
.engine_initialized? ⇒ Boolean
Check to see if JSMin is loaded
12 13 14 |
# File 'lib/processit/processor/jsmin_template.rb', line 12 def self.engine_initialized? defined? ::JSMin end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
Compile template data with JSMin compiler.
28 29 30 |
# File 'lib/processit/processor/jsmin_template.rb', line 28 def evaluate(scope, locals, &block) @output ||= ::JSMin.minify(data) end |
#initialize_engine ⇒ Object
Autoload jsmin library. If the library isn’t loaded, Tilt will produce a thread safetly warning. If you intend to use ‘.js` files, you should explicitly require it.
19 20 21 |
# File 'lib/processit/processor/jsmin_template.rb', line 19 def initialize_engine require_template_library 'jsmin' end |
#prepare ⇒ Object
23 24 25 |
# File 'lib/processit/processor/jsmin_template.rb', line 23 def prepare @output = nil end |