Class: Netzke::Core::CssConfig
- Inherits:
-
Object
- Object
- Netzke::Core::CssConfig
- Defined in:
- lib/netzke/core/css_config.rb
Overview
Instance Attribute Summary collapse
-
#required_files ⇒ Object
Returns the value of attribute required_files.
Instance Method Summary collapse
-
#initialize(klass) ⇒ CssConfig
constructor
A new instance of CssConfig.
-
#require(*args) ⇒ Object
Use it to specify extra stylesheet files to be loaded for the component.
Constructor Details
#initialize(klass) ⇒ CssConfig
Returns a new instance of CssConfig.
14 15 16 17 |
# File 'lib/netzke/core/css_config.rb', line 14 def initialize(klass) @klass = klass @required_files = [] end |
Instance Attribute Details
#required_files ⇒ Object
Returns the value of attribute required_files.
12 13 14 |
# File 'lib/netzke/core/css_config.rb', line 12 def required_files @required_files end |
Instance Method Details
#require(*args) ⇒ Object
Use it to specify extra stylesheet files to be loaded for the component.
It may accept one or more symbols or strings.
Symbols will be expanded following a convention, e.g.:
class MyComponent < Netzke::Base
client_styles do |c|
c.require :some_styles
end
end
This will “require” a stylesheet file {component_location}/my_component/client/some_styles.css
Strings will be interpreted as full paths to the required JavaScript file:
client_styles do |c|
c.require "#{File.dirname(__FILE__)}/my_component/one.css", "#{File.dirname(__FILE__)}/my_component/two.css"
end
38 39 40 41 |
# File 'lib/netzke/core/css_config.rb', line 38 def require(*args) callr = caller.first @required_files |= args.map{ |a| a.is_a?(Symbol) ? (a, callr) : a } end |