Class: Brut::FrontEnd::Layout

Inherits:
Component
  • Object
show all
Defined in:
lib/brut/front_end/layout.rb

Overview

A layout is common HTML that surrounds different pages. For example, it would hold your DOCTYPE, <head>, and possibly any common <body> elements that every page needs.

A layout is a Phlex component but it must contain a call to yield somewhere in the implementation of view_template.

This base class contains helper methods needed for implementing a layout.

Instance Method Summary collapse

Methods inherited from Component

component_name, #component_name

Methods included from Component::Helpers

#global_component, #inline_svg

Methods included from I18n::ForHTML

#html_escape, #t

Methods included from I18n::BaseMethods

#l, #t, #t_direct, #this_field_value

Methods included from Brut::Framework::Errors

#abstract_method!, #bug!

Instance Method Details

#asset_path(path) ⇒ String

Get the actual path of an asset managed by Brut. This handles locating the asset's URL as well as ensuring the hash is properly inserted into the filename.

Parameters:

  • path (String)

    the path to an asset, such as /css/styles.css.

Returns:

  • (String)

    the actual path to the current version of that asset.

See Also:



18
# File 'lib/brut/front_end/layout.rb', line 18

def asset_path(path) = Brut.container.asset_path_resolver.resolve(path)