Module: Cljs::Rails::Helper
- Defined in:
- lib/cljs/rails/helper.rb
Overview
Asset path helpers for use with webpack
Instance Method Summary collapse
- #cljs_main_dev_path ⇒ Object
-
#cljs_main_path ⇒ Object
Return asset paths for a particular webpack entry point.
- #cljs_main_prod_path ⇒ Object
Instance Method Details
#cljs_main_dev_path ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cljs/rails/helper.rb', line 28 def cljs_main_dev_path port = ::Rails.configuration.cljs.dev_server.port protocol = ::Rails.configuration.cljs.dev_server.https ? 'https' : 'http' main = ::Rails.configuration.cljs.main_target host = ::Rails.configuration.cljs.dev_server.host host = instance_eval(&host) if host.respond_to?(:call) # if ::Rails.env.developmtn "#{protocol}://#{host}:#{port}/#{main}.js" end |
#cljs_main_path ⇒ Object
Return asset paths for a particular webpack entry point.
Response may either be full URLs (eg localhost/…) if the dev server is in use or a host-relative URl (eg /webpack/…) if assets are precompiled.
Will raise an error if our manifest can’t be found or the entry point does not exist.
14 15 16 17 18 19 20 |
# File 'lib/cljs/rails/helper.rb', line 14 def cljs_main_path if ::Rails.env.production? cljs_main_prod_path else cljs_main_dev_path end end |
#cljs_main_prod_path ⇒ Object
22 23 24 25 26 |
# File 'lib/cljs/rails/helper.rb', line 22 def cljs_main_prod_path # ``app/assets/cljs-build`` has to be added to the asset paths main = ::Rails.configuration.cljs.main_target "#{main}.js" end |