Sha256: 46808a472e5c347473f8d1d6582b139b148da23c71e8a434d35d589f1414c9a3

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# Required so that if you include only the helpers file, version is still there
require 'slim-grunt-helpers/version'
require 'slim-grunt-helpers/models'

module SlimGruntHelpers

  module Helpers

    def sg_enclose_newline
      %Q{\n#{ yield }\n}
    end

    # Options:
    # - `alt` which allows to set alternate paths which usemin should look into
    def sg_usemin_css(path, options={})
      usemin  = SlimGruntHelpers::Models::UseminCss.new
      options = { alt: nil }.merge!(options)

      alt = ''
      alt = "(#{ options[:alt] })" unless options[:alt].nil?

      text  = "\n<!-- build:css#{ alt } #{ path } -->\n"
      yield(usemin)
      usemin.each do |link|
        text << "#{ link }\n"
      end
      text << "<!-- endbuild -->\n"
    end

    # Options:
    # - `alt` which allows to set alternate paths which usemin should look into
    def sg_usemin_js(path, options={})
      usemin  = SlimGruntHelpers::Models::UseminJs.new
      options = { alt: nil }.merge!(options)

      alt = ''
      alt = "(#{ options[:alt] })" unless options[:alt].nil?

      text  = "\n<!-- build:js#{ alt } #{ path } -->\n"
      yield(usemin)
      usemin.each do |link|
        text << "#{ link }\n"
      end
      text << "<!-- endbuild -->\n"
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slim-grunt-helpers-0.0.4 lib/slim-grunt-helpers/helpers.rb
slim-grunt-helpers-0.0.3 lib/slim-grunt-helpers/helpers.rb