I have been playing with a new tool that I called styler. It tries to help to compose css classes and give them names to styles, with code that looks like this…
styles = Styler.new do
style :default, ["pa3", "white", "bg_blue"]
style :danger, [default - "bg_blue", "bg_red"]
end
styles.default.to_s # => "pa3 white bg_blue"
styles.danger.to_s # => "pa3 white bg_red"
For now is more an idea, although it works, and you can play with it if you want 
In this article I show how it works: Styler, a tool to compose css classes with ruby
And in this article I show a little page that I am building with examples using tachyons (that is very similar to tailwindcss): Styler and tachyons examples
In the example of @Vlado_Cingel you could have done something like…
module StylesHelper
def styles
@styles ||= Styler.new do
collection :button do
style :solid, %w(bg-green-800 font-semibold hover:bg-green-700 p-3 text-sm text-white rounded-md)
style :outlined, %w(bg-green-800 font-semibold hover:bg-green-700 p-3 text-sm text-white rounded-md)
end
end
end
end
<%= button_tag "hola", class: styles.button.solid %>
<%= button_tag "hola", class: styles.button.outlined %>
<%= link_to "hola", class: styles.button.solid %>
In the examples site, show how you can build a buttons collection like this…
With this code…
styles = Styler.new do
colors = [
:black, :near_black, :dark_gray, :mid_gray,
:purple, :light_purple, :hot_pink, :dark_pink,
:navy, :dark_blue, :dark_green
]
color_class = -> color { color.to_s.gsub("_", "-") }
bg_class = -> color { "bg-#{color_class.(color)}" }
style :base, %w(f6 link dim ph3 pv2 mb2 dib)
collection :button do
colors.each do |color|
style color, [base, "white", bg_class.(color)]
end
collection :thin_border do
colors.each do |color|
style color, [base, "ba", color_class.(color)]
end
end
collection :border do
colors.each do |color|
style color, [base, "ba", "bw1", color_class.(color)]
end
end
collection :thick_border do
colors.each do |color|
style color, [base, "ba", "bw1", color_class.(color)]
end
end
end
end
<div class="ph3">
<h1 class="f6 fw6 ttu tracked">Basic button</h1>
<a class="<%= styles.button.black %>" href="#0">Button Text</a>
<a class="<%= styles.button.near_black %>" href="#0">Button Text</a>
<a class="<%= styles.button.dark_gray %>" href="#0">Button Text</a>
<a class="<%= styles.button.mid_gray %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.light_purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.hot_pink %>" href="#0">Button Text</a>
<a class="<%= styles.button.dark_pink %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.navy %>" href="#0">Button Text</a>
<a class="<%= styles.button.dark_blue %>" href="#0">Button Text</a>
<a class="<%= styles.button.dark_green %>" href="#0">Button Text</a>
</div>
<div class="ph3 mt4">
<h1 class="f6 fw6 ttu tracked">Basic Button with Thin Border</h1>
<a class="<%= styles.button.thin_border.black %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.near_black %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.dark_gray %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.mid_gray %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.thin_border.purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.light_purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.hot_pink %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.dark_pink %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.thin_border.navy %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.dark_blue %>" href="#0">Button Text</a>
<a class="<%= styles.button.thin_border.dark_green %>" href="#0">Button Text</a>
</div>
<div class="ph3 mt4">
<h1 class="f6 fw6 ttu tracked">Basic Button with Border</h1>
<a class="<%= styles.button.border.black %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.near_black %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.dark_gray %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.mid_gray %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.border.purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.light_purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.hot_pink %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.dark_pink %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.border.navy %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.dark_blue %>" href="#0">Button Text</a>
<a class="<%= styles.button.border.dark_green %>" href="#0">Button Text</a>
</div>
<div class="ph3 mt4">
<h1 class="f6 fw6 ttu tracked">Basic Button with Thick Border</h1>
<a class="<%= styles.button.thick_border.black %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.near_black %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.dark_gray %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.mid_gray %>" href="#0">Button Text</a>
</div>
<div class="ph3">
<a class="<%= styles.button.thick_border.purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.light_purple %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.hot_pink %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.dark_pink %>" href="#0">Button Text</a>
</div>
<div class="ph3 mb4">
<a class="<%= styles.button.thick_border.navy %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.dark_blue %>" href="#0">Button Text</a>
<a class="<%= styles.button.thick_border.dark_green %>" href="#0">Button Text</a>
</div>