Module: StyleCapsule::Helper

Includes:
HelperScopeCache
Defined in:
lib/style_capsule/helper.rb,
sig/style_capsule.rbs

Overview

ERB Helper module for use in Rails views

This module is automatically included in ActionView::Base via Railtie. No manual inclusion is required - helpers are available in all ERB templates.

Usage in ERB templates:

<%= style_capsule do %>
<style>
  .section { color: red; }
  .heading:hover { opacity: 0.8; }
</style>
<div class="section">
  <h2 class="heading">Hello</h2>
</div>
<% end %>

The CSS will be automatically scoped and content wrapped in a scoped div. The