Sha256: b15a5f2eff57bc1339a7bcd762fd8a89e988e3f888e982dd7a6288101cd6bac9
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module Revelry module Generators module Content class JsGenerator < ::Rails::Generators::Base JS_FILE_EXTENSIONS = %w( .coffee .coffee.erb .js.coffee .js.coffee.rb .js .js.rb ) def add_js_assets insert_into_file js_app_bundle, before: %r{(//|#)= require_tree \.} do "#{ js_require_marker }= require revelry_content\n" end end private def js_app_bundle File.join(js_base_dir, "revelry-app#{ js_file_extname }") end def test_js_format(fmt) File.exist?(File.join(js_base_dir, "revelry-app#{ fmt }")) end def js_base_dir File.join('app', 'assets', 'javascripts') end def js_file_extname JS_FILE_EXTENSIONS.find { |fmt| test_js_format(fmt) } end def js_require_marker '#' if js_file_extname.include?('coffee') '//' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
revelry_content-1.0.0 | lib/generators/revelry/content/js_generator.rb |