Method: TailwindTheme::Theme#merge_css

Defined in:
lib/tailwind_theme.rb

#merge_css(paths, options = {}) ⇒ String

Combine multiple paths and merging the combined Tailwind CSS classes.

Default options are:

:raise => false

Parameters:

  • paths (Array<String, Symbol, Array<String, Symbol>>)

    the array of paths to combine

  • options (Hash<Symbol, Object>) (defaults to: {})

    the options to use when parsing the css theme

Options Hash (options):

  • prepend (prepend)

    the classnames before merging the Tailwind Classes

  • append (append)

    the classnames before merging the Tailwind Classes

  • raise (Boolean)

    raise an ‘IndexError` if the a path does not exist

  • object (Object)

    the object to apply the sub theme

  • attributes (Hash<String, Object>)

    the attributes to apply the sub theme. Overrides the attributes defined in ‘options`.

Returns:

  • (String)

    the merged Tailwind CSS classes

Raises:

  • (IndexError)

    if the :raise options is true and a path cannot be found

  • (ArgumentError)

    if processing an object theme and the object or attributes option is not defined



128
129
130
131
# File 'lib/tailwind_theme.rb', line 128

def merge_css(paths, options = {})
  classnames = paths.map { |path| build path, options }.compact.join(" ")
  merge classnames, options
end