Module: TailwindTheme
- Defined in:
- lib/tailwind_theme.rb,
lib/tailwind_theme/version.rb
Overview
Namespace for the tailwind_theme code
Defined Under Namespace
Classes: Theme
Constant Summary collapse
- VERSION =
"0.1.1"
Class Attribute Summary collapse
-
.merger ⇒ Object
Returns the global [TailwindMerge::Merge](github.com/gjtorikian/tailwind_merge) merge object using the global ‘merge_config` object.
- .merger_config ⇒ Object
-
.missing_classname(path) ⇒ Nil, String
Generate the missing CSS class name from the path.
Class Method Summary collapse
-
.load_file(path) ⇒ TailwindTheme::Theme
Loads the YAML theme file.
Class Attribute Details
.merger ⇒ Object
Returns the global [TailwindMerge::Merge](github.com/gjtorikian/tailwind_merge) merge object using the global ‘merge_config` object.
22 23 24 |
# File 'lib/tailwind_theme.rb', line 22 def self.merger @merger ||= TailwindMerge::Merger.new(config: merger_config) end |
.merger_config ⇒ Object
16 17 18 |
# File 'lib/tailwind_theme.rb', line 16 def self.merger_config @merger_config ||= {} end |
.missing_classname(path) ⇒ Nil, String
Generate the missing CSS class name from the path
44 45 46 47 48 49 50 51 52 |
# File 'lib/tailwind_theme.rb', line 44 def self.missing_classname(path) if @missing_classname.nil? || @missing_classname == true "missing-#{path.join "-"}" elsif @missing_classname.is_a? Proc @missing_classname.call path elsif !!@missing_classname @missing_classname.to_s end end |
Class Method Details
.load_file(path) ⇒ TailwindTheme::Theme
Loads the YAML theme file.
35 36 37 38 39 |
# File 'lib/tailwind_theme.rb', line 35 def self.load_file(path) contents = File.read path contents = ERB.new(contents).result if path.end_with?(".erb") Theme.new YAML.safe_load(contents, aliases: true, filename: path) end |