Module: Proscenium::CssModule
- Extended by:
- ActiveSupport::Autoload
- Included in:
- Phlex::CssModules
- Defined in:
- lib/proscenium/css_module.rb,
lib/proscenium/css_module/rewriter.rb
Defined Under Namespace
Modules: Path Classes: Rewriter, TransformError, Transformer
Instance Method Summary collapse
-
#class_names(*names, path: nil) ⇒ String
The transformed CSS module names concatenated as a string.
-
#css_module(*names, path: nil) ⇒ String
Accepts one or more CSS class names, and transforms them into CSS module names.
Instance Method Details
#class_names(*names, path: nil) ⇒ String
Returns the transformed CSS module names concatenated as a string.
32 33 34 35 36 |
# File 'lib/proscenium/css_module.rb', line 32 def class_names(*names, path: nil) names = names.flatten.compact transformer = path.nil? ? cssm : Transformer.new(path) transformer.class_names(*names).map { |name, _| name }.join(' ') unless names.empty? end |
#css_module(*names, path: nil) ⇒ String
Accepts one or more CSS class names, and transforms them into CSS module names.
24 25 26 27 |
# File 'lib/proscenium/css_module.rb', line 24 def css_module(*names, path: nil) transformer = path.nil? ? cssm : Transformer.new(path) transformer.class_names(*names, require_prefix: false).map { |name, _| name }.join(' ') end |