Module: Tailwindcss

Extended by:
Dry::Configurable, Tailwindcss, ExtendTheme
Includes:
Constants
Included in:
Tailwindcss
Defined in:
lib/tailwindcss.rb,
lib/tailwindcss/style.rb,
lib/tailwindcss/helpers.rb,
lib/tailwindcss/version.rb,
lib/tailwindcss/constants.rb,
lib/tailwindcss/installer.rb,
lib/tailwindcss/asset_helper.rb,
lib/tailwindcss/arbitrary_value.rb,
lib/tailwindcss/compiler/output.rb,
lib/tailwindcss/compiler/runner.rb,
lib/tailwindcss/compiler/channel.rb,
lib/tailwindcss/compiler/connection.rb,
lib/tailwindcss/compiler/file_parser.rb,
lib/tailwindcss/compiler/hash_args_extractor.rb,
lib/tailwindcss/compiler/file_classes_extractor.rb,
lib/tailwindcss/installers/config_file_generator.rb,
lib/tailwindcss/style_attributes_to_list_converter.rb

Defined Under Namespace

Modules: AssetHelper, Compiler, Constants, ExtendTheme, Helpers, Installers Classes: ArbitraryValue, Installer, Style, StyleAttributesToListConverter

Constant Summary collapse

VERSION =
"0.1.0"

Constants included from Constants

Constants::ALIGN_CONTENT, Constants::ALIGN_ITEMS, Constants::BACKFACE_VISIBILITY, Constants::BACKGROUND_ATTACHMENT, Constants::BACKGROUND_BLEND_MODE, Constants::BACKGROUND_CLIP, Constants::BACKGROUND_IMAGE, Constants::BACKGROUND_ORIGIN, Constants::BACKGROUND_POSITION, Constants::BACKGROUND_REPEAT, Constants::BACKGROUND_SIZE, Constants::BORDER, Constants::BORDER_COLLAPSE, Constants::BORDER_RADIUS, Constants::BORDER_RADIUSES, Constants::BORDER_STYLE, Constants::BORDER_WIDTH, Constants::BOX_DECORATION_BREAK, Constants::BOX_SHADOW, Constants::BOX_SIZING, Constants::BREAKPOINTS, Constants::CAPTION_SIDE, Constants::CLEAR, Constants::COLORS, Constants::COLOR_SCHEME, Constants::COLOR_WEIGHTS, Constants::COLOR_WITH_WEIGHTS, Constants::COLUMNS, Constants::COLUMN_END, Constants::COLUMN_SPAN, Constants::COLUMN_START, Constants::CONTENT, Constants::CURSOR, Constants::DISPLAY, Constants::EMPTY_CELLS, Constants::FLEX, Constants::FLEX_BASIS, Constants::FLEX_DIRECTION, Constants::FLEX_GROW, Constants::FLEX_SHRINK, Constants::FLEX_WRAP, Constants::FONT_FAMILY, Constants::FONT_SIZE, Constants::FONT_STYLE, Constants::FONT_VARIANT_NUMERIC, Constants::FONT_WEIGHT, Constants::GRID_AUTO_COLUMNS, Constants::GRID_AUTO_FLOW, Constants::GRID_AUTO_ROWS, Constants::GRID_TEMPLATE_COLUMNS, Constants::GRID_TEMPLATE_ROWS, Constants::GROUP, Constants::HYPHENS, Constants::ISOLATION, Constants::JUSTIFY_CONTENT, Constants::JUSTIFY_ITEMS, Constants::JUSTIFY_SELF, Constants::LETTER_SPACING, Constants::LINE_HEIGHT, Constants::LIST_STYLE_IMAGE, Constants::LIST_STYLE_POSITION, Constants::LIST_STYLE_TYPE, Constants::MAX_SIZE, Constants::MIN_SIZE, Constants::MIX_BLEND_MODE, Constants::OBJECT_FIT, Constants::OBJECT_POSITION, Constants::OPACITY, Constants::ORDER, Constants::OUTLINE_STYLE, Constants::OUTLINE_WIDTH, Constants::OVERFLOW, Constants::PLACE_ITEMS, Constants::PLACE_SELF, Constants::POINTER_EVENTS, Constants::POSITION, Constants::PSEUDO_ELEMENTS, Constants::PSEUDO_SELECTORS, Constants::RESIZE, Constants::ROTATE, Constants::ROW_END, Constants::ROW_SPAN, Constants::ROW_START, Constants::SCALE, Constants::SCROLL_BEHAVIOR, Constants::SCROLL_SNAP_ALIGN, Constants::SCROLL_SNAP_STOP, Constants::SCROLL_SNAP_TYPE, Constants::SIZES, Constants::SPACING, Constants::TABLE_LAYOUT, Constants::TEXT_ALIGN, Constants::TEXT_DECORATION, Constants::TEXT_DECORATION_STYLE, Constants::TEXT_DECORATION_THICKNESS, Constants::TEXT_OVERFLOW, Constants::TEXT_TRANSFORM, Constants::TEXT_UNDERLINE_OFFSET, Constants::THEME, Constants::TRANSFORM_ORIGIN, Constants::TRANSITION, Constants::TRANSLATE, Constants::USER_SELECT, Constants::VERTICAL_ALIGN, Constants::VISIBILITY, Constants::WHITESPACE, Constants::WILL_CHANGE, Constants::WORD_BREAK, Constants::Z_INDEX

Instance Method Summary collapse

Methods included from ExtendTheme

extend_theme

Instance Method Details

#compile_css!Object



61
62
63
64
65
# File 'lib/tailwindcss.rb', line 61

def compile_css!
  Tailwindcss.config.logger.call.info "Recompiling Tailwindcss..."
  system "npx tailwindcss -o #{output_path} -m"
  Channel.broadcast_css_changed if defined?(ActionCable)
end

#configure(&blk) ⇒ Object



51
52
53
54
# File 'lib/tailwindcss.rb', line 51

def configure(&blk)
  super(&blk)
  init!
end

#init!Object



56
57
58
59
# File 'lib/tailwindcss.rb', line 56

def init!
  require "tailwindcss/style"
  Compiler::Runner.new.call
end

#loggerObject



75
76
77
# File 'lib/tailwindcss.rb', line 75

def logger
  @logger ||= config.logger.call
end

#output_pathObject



67
68
69
# File 'lib/tailwindcss.rb', line 67

def output_path
  @output_path ||= Tailwindcss.config.compiler.output_path.call
end

#tailwind_css_file_pathObject



71
72
73
# File 'lib/tailwindcss.rb', line 71

def tailwind_css_file_path
  @tailwind_css_file_path ||= Tailwindcss.config.tailwind_css_file_path.call
end

#themeObject



47
48
49
# File 'lib/tailwindcss.rb', line 47

def theme
  @theme ||= OpenStruct.new(self.config.theme.to_h.transform_values { _1.respond_to?(:call) ? _1.() : _1 })
end