Module: Sqwish
- Defined in:
- lib/sqwish.rb
Defined Under Namespace
Modules: Strict
Class Method Summary collapse
- .minify(src, options = {:strict => false}) ⇒ Object (also: compress)
- .sqwish_js ⇒ Object
- .sqwish_js_path ⇒ Object
- .sqwish_src ⇒ Object
- .sqwish_wrapper ⇒ Object
- .version ⇒ Object
Class Method Details
.minify(src, options = {:strict => false}) ⇒ Object Also known as: compress
6 7 8 9 |
# File 'lib/sqwish.rb', line 6 def minify(src, ={:strict => false}) is_strict = !! [:strict] sqwish_js.call "sqwish", src, is_strict end |
.sqwish_js ⇒ Object
13 14 15 |
# File 'lib/sqwish.rb', line 13 def sqwish_js @squish_js ||= ExecJS.compile(sqwish_wrapper) end |
.sqwish_js_path ⇒ Object
30 31 32 |
# File 'lib/sqwish.rb', line 30 def sqwish_js_path File. '../../sqwish/src/index.js', __FILE__ end |
.sqwish_src ⇒ Object
26 27 28 |
# File 'lib/sqwish.rb', line 26 def sqwish_src src = open(sqwish_js_path).read end |
.sqwish_wrapper ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/sqwish.rb', line 17 def sqwish_wrapper # Since we're not using node, some things will have to be stubbed. %{ var require = function() { return {}; }; var module = { exports: {} }; #{sqwish_src} } end |
.version ⇒ Object
34 35 36 |
# File 'lib/sqwish.rb', line 34 def version "0.2.0.1" end |