Sha256: 54e2c3ceda116dd0752fb861847f160f7933e8f3c99127b7e0f75c158d112540

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module MicroCms
  module ApplicationHelper
    # rubocop:disable Rails/OutputSafety
    def micro_cms_asset_tags
      js = load_gem_file 'micro_cms', 'app/assets/javascripts/micro_cms.js'
      css = load_gem_file 'micro_cms', 'app/assets/stylesheets/micro_cms/micro_cms.css'
      tag.script(js.html_safe) + tag.style(css)
    end
    # rubocop:enable Rails/OutputSafety

    private

    def load_gem_file(gem_name, assets_path)
      path = File.join(Gem.loaded_specs[gem_name].full_gem_path, assets_path)
      File.read(path)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
micro_cms-0.2.1 app/helpers/micro_cms/application_helper.rb
micro_cms-0.2.0 app/helpers/micro_cms/application_helper.rb
micro_cms-0.1.2 app/helpers/micro_cms/application_helper.rb