Module: Webpack::ViewHelpers

Defined in:
lib/webpack/view_helpers.rb

Defined Under Namespace

Classes: Context

Instance Method Summary collapse

Instance Method Details

#webpack_contextObject



3
4
5
# File 'lib/webpack/view_helpers.rb', line 3

def webpack_context
  Context.new(self)
end

#webpack_css_tag(name, **options) ⇒ Object

Parameters:

  • name (String)


13
14
15
# File 'lib/webpack/view_helpers.rb', line 13

def webpack_css_tag(name, **options)
  stylesheet_link_tag(webpack_entry_url(name, :css), options) if Webpack.config.extract_css
end

#webpack_entry_url(name, ext) ⇒ String

Parameters:

  • name (String)
  • ext (String)

Returns:

  • (String)


20
21
22
# File 'lib/webpack/view_helpers.rb', line 20

def webpack_entry_url(name, ext)
  webpack_context.entry_url(name, ext)
end

#webpack_js_tag(name, **options) ⇒ Object

Parameters:

  • name (String)


8
9
10
# File 'lib/webpack/view_helpers.rb', line 8

def webpack_js_tag(name, **options)
  javascript_include_tag(webpack_entry_url(name, :js), options)
end

#webpack_static_file_url(path) ⇒ String

Parameters:

  • path (String)

Returns:

  • (String)


26
27
28
# File 'lib/webpack/view_helpers.rb', line 26

def webpack_static_file_url(path)
  webpack_context.static_file_url(path)
end