Module: Proscenium::Helper
- Defined in:
- lib/proscenium/helper.rb
Instance Method Summary collapse
- #compute_asset_path(path, options = {}) ⇒ Object
- #proscenium_dev ⇒ Object
- #side_load_javascripts(**options) ⇒ Object
- #side_load_stylesheets ⇒ Object
Instance Method Details
#compute_asset_path(path, options = {}) ⇒ Object
5 6 7 8 9 |
# File 'lib/proscenium/helper.rb', line 5 def compute_asset_path(path, = {}) return "/#{path}" if %i[javascript stylesheet].include?([:type]) super end |
#proscenium_dev ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/proscenium/helper.rb', line 23 def proscenium_dev return if !Rails.env.development? || !Proscenium::Railtie.websocket javascript_tag %( import autoReload from '/proscenium-runtime/auto_reload.js'; autoReload('#{Proscenium::Railtie.websocket_mount_path}'); ), type: 'module' end |
#side_load_javascripts(**options) ⇒ Object
17 18 19 20 21 |
# File 'lib/proscenium/helper.rb', line 17 def side_load_javascripts(**) return unless Proscenium::Current.loaded javascript_include_tag(*Proscenium::Current.loaded[:js], ) end |
#side_load_stylesheets ⇒ Object
11 12 13 14 15 |
# File 'lib/proscenium/helper.rb', line 11 def side_load_stylesheets return unless Proscenium::Current.loaded stylesheet_link_tag(*Proscenium::Current.loaded[:css]) end |