Sha256: b0aa34350ac18ad8926fe2b33e5b066e445645b519cdf57be3b1799c981cc427

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

module AmpHtml
    module BaseHelper

        def amp?
            if AmpHtml.configuration.split_view
                return params[:amp] if params.has_key?(:amp)
                AmpHtml.configuration.split_view_default == 'amp'
            else
                true
            end
        end

        # Fix for accessing AMP assets in different environments
        def get_asset name
            if Rails.application.assets
                asset = Rails.application.assets[name]
                return asset.to_s if asset
            end
            asset = Rails.application.assets_manifest.assets[name]
            return nil unless asset
            return File.binread(File.join(Rails.application.assets_manifest.dir, asset))
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp-html-1.0.1 app/helpers/amp_html/base_helper.rb