Sha256: f78e37585589d2d402e9f4b5484cc8e2ebf3af36515f63d05603888e8ea338ee
Contents?: true
Size: 835 Bytes
Versions: 2
Compression:
Stored size: 835 Bytes
Contents
require 'puppet-herald' require 'uglifier' module PuppetHerald class Javascript @@files = nil @@base = 'lib/puppet-herald/public' def self.files if PuppetHerald::is_in_dev? @@files = nil end if @@files.nil? public_dir = PuppetHerald::relative_dir(@@base) all = Dir.chdir(public_dir) { Dir.glob('**/*.js') } @@files = all.reverse.reject { |file| file.match(/_test\.js$/) } end return @@files end def self.uglify mapname sources = files.collect { |file| File.read("#{@@base}/#{file}") } source = sources.join "\n" uglifier = Uglifier.new(:source_map_url => mapname) uglified, source_map = uglifier.compile_with_map(source) return { 'js' => uglified, 'js.map' => source_map } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-herald-0.1.1 | lib/puppet-herald/javascript.rb |
puppet-herald-0.1.0 | lib/puppet-herald/javascript.rb |