js_image_paths-0.1.1/0000755000004100000410000000000013154176516014527 5ustar www-datawww-datajs_image_paths-0.1.1/js_image_paths.gemspec0000644000004100000410000000334013154176516021051 0ustar www-datawww-data######################################################### # This file has been automatically generated by gem2tgz # ######################################################### # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "js_image_paths" s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Jonne Ha\u{df}"] s.date = "2017-08-07" s.description = "Easily access your image assets in your JavaScript code" s.email = ["me@jhass.eu"] s.files = ["LICENSE.txt", "app/assets/javascripts/js_image_paths.js.erb", "lib/js_image_paths.rb", "lib/js_image_paths/engine.rb", "lib/js_image_paths/generator.rb", "lib/js_image_paths/version.rb"] s.homepage = "https://github.com/jhass/js_image_paths" s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubygems_version = "1.8.23" s.summary = "Rails image paths in your JS" if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q, ["~> 1.10"]) s.add_runtime_dependency(%q, ["< 6.0", ">= 4.0"]) s.add_development_dependency(%q, ["~> 10.0"]) s.add_runtime_dependency(%q, [">= 3.0.0"]) else s.add_dependency(%q, ["~> 1.10"]) s.add_dependency(%q, ["< 6.0", ">= 4.0"]) s.add_dependency(%q, ["~> 10.0"]) s.add_dependency(%q, [">= 3.0.0"]) end else s.add_dependency(%q, ["~> 1.10"]) s.add_dependency(%q, ["< 6.0", ">= 4.0"]) s.add_dependency(%q, ["~> 10.0"]) s.add_dependency(%q, [">= 3.0.0"]) end end js_image_paths-0.1.1/LICENSE.txt0000644000004100000410000000205313154176515016351 0ustar www-datawww-dataCopyright (c) 2014 Jonne Haß MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. js_image_paths-0.1.1/lib/0000755000004100000410000000000013154176515015274 5ustar www-datawww-datajs_image_paths-0.1.1/lib/js_image_paths/0000755000004100000410000000000013154176515020251 5ustar www-datawww-datajs_image_paths-0.1.1/lib/js_image_paths/engine.rb0000644000004100000410000000107713154176515022050 0ustar www-datawww-datamodule JsImagePaths class Engine < Rails::Engine isolate_namespace(JsImagePaths) initializer('js_image_paths.compile', after: 'sprockets.environment') do |application| sprockets_env = application.assets || Sprockets sprockets_env.register_preprocessor('application/javascript', :'js_image_path.compile') do |input| context = input[:environment].context_class.new(input) if context.logical_path == 'js_image_paths' JsImagePaths::Generator.context = context end {data: input[:data]} end end end end js_image_paths-0.1.1/lib/js_image_paths/version.rb0000644000004100000410000000005413154176515022262 0ustar www-datawww-datamodule JsImagePaths VERSION = "0.1.1" end js_image_paths-0.1.1/lib/js_image_paths/generator.rb0000644000004100000410000000056113154176515022566 0ustar www-datawww-datamodule JsImagePaths module Generator cattr_accessor :context def self.generate image_hash.to_json end def self.image_hash images = context.environment.each_logical_path(->(_, path) { path.include? "images" }) images.each_with_object({}) do |path, images| images[path] = context.asset_path(path) end end end end js_image_paths-0.1.1/lib/js_image_paths.rb0000644000004100000410000000017413154176515020600 0ustar www-datawww-datarequire "js_image_paths/version" require "js_image_paths/engine" require "js_image_paths/generator" module JsImagePaths end js_image_paths-0.1.1/app/0000755000004100000410000000000013154176515015306 5ustar www-datawww-datajs_image_paths-0.1.1/app/assets/0000755000004100000410000000000013154176515016610 5ustar www-datawww-datajs_image_paths-0.1.1/app/assets/javascripts/0000755000004100000410000000000013154176515021141 5ustar www-datawww-datajs_image_paths-0.1.1/app/assets/javascripts/js_image_paths.js.erb0000644000004100000410000000023513154176515025223 0ustar www-datawww-datavar ImagePaths = (function(images) { return { get: function(name) { return images[name]; } }; })(<%= JsImagePaths::Generator.generate %>);