Module: HandlebarsAssets::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/handlebars_assets/config.rb

Overview

Change config options in an initializer:

HandlebarsAssets::Config.path_prefix = ‘app/templates’

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amd=(value) ⇒ Object (writeonly)

Sets the attribute amd

Parameters:

  • value

    the value to set the attribute amd to.



9
10
11
# File 'lib/handlebars_assets/config.rb', line 9

def amd=(value)
  @amd = value
end

#amd_with_template_namespaceObject

indicate whether the template should be added to the global template namespace



119
120
121
# File 'lib/handlebars_assets/config.rb', line 119

def amd_with_template_namespace
  @amd_with_template_namespace || false
end

#chomp_underscore_for_partials=(value) ⇒ Object (writeonly)

Sets the attribute chomp_underscore_for_partials

Parameters:

  • value

    the value to set the attribute chomp_underscore_for_partials to.



9
10
11
# File 'lib/handlebars_assets/config.rb', line 9

def chomp_underscore_for_partials=(value)
  @chomp_underscore_for_partials = value
end

#compilerObject



17
18
19
# File 'lib/handlebars_assets/config.rb', line 17

def compiler
  @compiler || 'handlebars.js'
end

#compiler_pathObject



25
26
27
# File 'lib/handlebars_assets/config.rb', line 25

def compiler_path
  @compiler_path || HandlebarsAssets.path
end

#ember=(value) ⇒ Object (writeonly)

Sets the attribute ember

Parameters:

  • value

    the value to set the attribute ember to.



9
10
11
# File 'lib/handlebars_assets/config.rb', line 9

def ember=(value)
  @ember = value
end

#haml_enabled=(value) ⇒ Object (writeonly)

Sets the attribute haml_enabled

Parameters:

  • value

    the value to set the attribute haml_enabled to.



9
10
11
# File 'lib/handlebars_assets/config.rb', line 9

def haml_enabled=(value)
  @haml_enabled = value
end

#haml_optionsObject



46
47
48
# File 'lib/handlebars_assets/config.rb', line 46

def haml_options
  @haml_options || {}
end

#hamlbars_extensionsObject



101
102
103
# File 'lib/handlebars_assets/config.rb', line 101

def hamlbars_extensions
  @hamlbars_extensions ||= ['.hamlbars']
end

#handlebars_amd_pathObject

path specified by the require.js paths during configuration for the handlebars



125
126
127
# File 'lib/handlebars_assets/config.rb', line 125

def handlebars_amd_path
  @handlebars_amd_path || 'handlebars'
end

#handlebars_extensionsObject



97
98
99
# File 'lib/handlebars_assets/config.rb', line 97

def handlebars_extensions
  @hbs_extensions ||= ['.hbs', '.handlebars']
end

#known_helpersObject



63
64
65
# File 'lib/handlebars_assets/config.rb', line 63

def known_helpers
  @known_helpers || []
end

#known_helpers_onlyObject



67
68
69
70
# File 'lib/handlebars_assets/config.rb', line 67

def known_helpers_only
  @known_helpers_only = false if @known_helpers_only.nil?
  @known_helpers_only
end

#multiple_frameworks=(value) ⇒ Object (writeonly)

Sets the attribute multiple_frameworks

Parameters:

  • value

    the value to set the attribute multiple_frameworks to.



9
10
11
# File 'lib/handlebars_assets/config.rb', line 9

def multiple_frameworks=(value)
  @multiple_frameworks = value
end

#optionsObject



72
73
74
# File 'lib/handlebars_assets/config.rb', line 72

def options
  @options ||= generate_options
end

#patch_filesObject



76
77
78
# File 'lib/handlebars_assets/config.rb', line 76

def patch_files
  Array(@patch_files)
end

#patch_pathObject



80
81
82
# File 'lib/handlebars_assets/config.rb', line 80

def patch_path
  @patch_path ||= compiler_path
end

#path_prefixObject



84
85
86
# File 'lib/handlebars_assets/config.rb', line 84

def path_prefix
  @path_prefix ||= 'templates'
end

#precompileObject



88
89
90
91
# File 'lib/handlebars_assets/config.rb', line 88

def precompile
  @precompile = true if @precompile.nil?
  @precompile
end

#slim_enabled=(value) ⇒ Object (writeonly)

Sets the attribute slim_enabled

Parameters:

  • value

    the value to set the attribute slim_enabled to.



9
10
11
# File 'lib/handlebars_assets/config.rb', line 9

def slim_enabled=(value)
  @slim_enabled = value
end

#slim_optionsObject



59
60
61
# File 'lib/handlebars_assets/config.rb', line 59

def slim_options
  @slim_options || {}
end

#slimbars_extensionsObject



105
106
107
# File 'lib/handlebars_assets/config.rb', line 105

def slimbars_extensions
  @slimbars_extensions ||= ['.slimbars']
end

#template_namespaceObject



93
94
95
# File 'lib/handlebars_assets/config.rb', line 93

def template_namespace
  @template_namespace || 'HandlebarsTemplates'
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



21
22
23
# File 'lib/handlebars_assets/config.rb', line 21

def self.configure
  yield self
end

Instance Method Details

#amd?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/handlebars_assets/config.rb', line 113

def amd?
  @amd || false
end

#chomp_underscore_for_partials?Boolean

Indicate if leading underscore should be allowed when creating partial definition. Allows compatibility with handlebars-rails github.com/cowboyd/handlebars-rails/blob/f73a2d11df8aa2c21d335b8f04a8c5b59ae6a790/lib/handlebars-rails/tilt.rb#L18

Returns:

  • (Boolean)


133
134
135
# File 'lib/handlebars_assets/config.rb', line 133

def chomp_underscore_for_partials?
  @chomp_underscore_for_partials || false
end

#ember?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/handlebars_assets/config.rb', line 29

def ember?
  @ember || false
end

#ember_extensionsObject



109
110
111
# File 'lib/handlebars_assets/config.rb', line 109

def ember_extensions
  @ember_extensions ||= ['.ember']
end

#haml_available?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/handlebars_assets/config.rb', line 37

def haml_available?
  defined? ::Haml::Engine
end

#haml_enabled?Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/handlebars_assets/config.rb', line 41

def haml_enabled?
  @haml_enabled = true if @haml_enabled.nil?
  @haml_enabled
end

#multiple_frameworks?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/handlebars_assets/config.rb', line 33

def multiple_frameworks?
  @multiple_frameworks
end

#slim_available?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/handlebars_assets/config.rb', line 50

def slim_available?
  defined? ::Slim::Engine
end

#slim_enabled?Boolean

Returns:

  • (Boolean)


54
55
56
57
# File 'lib/handlebars_assets/config.rb', line 54

def slim_enabled?
  @slim_enabled = true if @slim_enabled.nil?
  @slim_enabled
end