lib/front_compiler.rb
# compacts javascript source from the given file
compacts javascript source from the given file
compacts javascript source from the given file
def compact_js(file_name, options={})
      source = File.open(file_name).read
      source.gsub! /\/\/.*?$/m, ''
      source.gsub! /\/\*.*?\*\//m, ''
      source.gsub! /\n\s*\n/im, "\n"
      source.gsub! /\n\s*/im, "\n"
      source.gsub! /\s*(=|\+|\-|<|>|\?|\|\||&&|\!|\{|\}|,|\)|\(|;|\]|\[|:|\*)\s*/im, '\1'
      source
    end
def compact_js ( file_name , options = { } ) source = File . open ( file_name ) . read source . gsub! / \/ \/ .*?$ /m , '' source . gsub! / \/ \* .*? \* \/ /m , '' source . gsub! / \n \s * \n /im , "\n" source . gsub! / \n \s * /im , "\n" source . gsub! / \s *(=| \+ | \- |<|>| \? | \| \| |&&| \! | \{ | \} |,| \) | \( |;| \] | \[ |:| \* ) \s * /im , '\1' source end
compacts javascript source from the given file
compacts javascript source from the given file
file_name
<not_specific>
options
<not_specific>