Sha256: fd4f93f4774d52a6e3c95bf79b3c17735640f07403bbe51765d57bf530aba36c

Contents?: true

Size: 841 Bytes

Versions: 5

Compression:

Stored size: 841 Bytes

Contents

module GulpAssets
  module ViewHelpers

    def gulp_asset_path(path)
      config = Rails.application.config.gulp_assets

      if Rails.env.development?
        "#{config.dev_host}#{config.path}/#{path}"
      else
        path = config.rev_manifest[path] if config.rev_manifest
        "#{config.path}/#{path}"
      end
    end

    def gulp_javascript(filename="main", attributes={})
      default_attributes = {
        src: gulp_asset_path("javascripts/#{filename}.js")
      }
      content_tag "script", nil, default_attributes.merge(attributes)
    end

    def gulp_stylesheet(filename="main", attributes={})
      default_attributes = {
        rel: "stylesheet",
        media: "all",
        href: gulp_asset_path("stylesheets/#{filename}.css")
      }
      tag 'link', default_attributes.merge(attributes)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gulp_assets-1.0.0.pre.6 lib/gulp_assets/view_helpers.rb
gulp_assets-1.0.0.pre.5 lib/gulp_assets/view_helpers.rb
gulp_assets-1.0.0.pre.4 lib/gulp_assets/view_helpers.rb
gulp_assets-1.0.0.pre.3 lib/gulp_assets/view_helpers.rb
gulp_assets-1.0.0.pre.2 lib/gulp_assets/view_helpers.rb