Module: Usps::Support::Helpers::ScssHelper
- Defined in:
- lib/usps/support/helpers/scss_helper.rb
Overview
Build CSS for mailers
Instance Method Summary collapse
Instance Method Details
#render_scss(file) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/usps/support/helpers/scss_helper.rb', line 8 def render_scss(file) text = Rails.root.join("app/views/layouts/scss/#{file}.scss").read # rubocop:disable Rails/OutputSafety # No user content raw sass_engine(text).render # rubocop:enable Rails/OutputSafety end |
#sass_engine(text) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/usps/support/helpers/scss_helper.rb', line 17 def sass_engine(text) view_context = controller.view_context SassC::Engine.new( text, syntax: :scss, cache: false, read_cache: false, style: :compressed, sprockets: { context: view_context, environment: view_context.assets_environment } ) end |