Sha256: 83b7010d827deed172d399e5fc55fab0e3066bb2e8371cfbaf4afe678c235241

Contents?: true

Size: 891 Bytes

Versions: 5

Compression:

Stored size: 891 Bytes

Contents

# encoding: UTF-8

require 'sass'

module Spontaneous::Output::Helpers
  module StylesheetHelper
    extend self

    def stylesheets(*args)
      stylesheet_urls(*args).map { |stylesheet|
        stylesheet_tag(stylesheet)
      }.join("\n")
    end

    def stylesheet_urls(*args)
      unless site.model.mapper.editable?
        begin
          ::Simultaneous.send_event('publish_progress', {:state => "compiling assets", :progress => "*"}.to_json)
        rescue Errno::ECONNREFUSED
        rescue Errno::ENOENT
        end
      end
      options = args.extract_options!
      options.update(:development => development?)
      asset_environment.css(args.flatten, options)
    end

    alias_method :stylesheet, :stylesheets

    def stylesheet_tag(href)
      %(<link rel="stylesheet" href="#{href}" />)
    end

    Spontaneous::Output::Helpers.register_helper(self, :html)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/output/helpers/stylesheet_helper.rb
spontaneous-0.2.0.beta9 lib/spontaneous/output/helpers/stylesheet_helper.rb
spontaneous-0.2.0.beta8 lib/spontaneous/output/helpers/stylesheet_helper.rb
spontaneous-0.2.0.beta7 lib/spontaneous/output/helpers/stylesheet_helper.rb
spontaneous-0.2.0.beta6 lib/spontaneous/output/helpers/stylesheet_helper.rb