Sha256: 5bc297db45e44edc5e1ba43038a3231ec2f06f51b182d181c89281c845dc0951
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
module Joosy::SprocketsHelper def extract_sources_and_sizes_from_include_tag(name) code = javascript_include_tag name resources = code.scan(/(?:href|src)=['"]([^'"]+)['"]/).flatten resources.map do |resource| path = ::Rails.root.to_s + "/public" + resource.split('?')[0] size = File.size(path) rescue false [resource, size] end.to_json.html_safe end def require_joosy_preloader_for(app_asset, options={}) preloader_asset = "joosy/preloaders/#{options[:preloader] || 'caching'}" force_preloader = options[:force] || false if force_preloader require_asset preloader_asset else require_asset Rails.env == 'development' ? app_asset : preloader_asset end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
joosy-0.1.0.RC2 | app/helpers/joosy/sprockets_helper.rb |