Sha256: 79c96416fef39da080f2af98f5deacff54ebd77919d3dba256b8a7b68e0335ca

Contents?: true

Size: 1.03 KB

Versions: 13

Compression:

Stored size: 1.03 KB

Contents

module Erector
  # Adds sass support to Erector widgets.
  #
  # Sass is an *optional dependency* of the Erector gem, so
  # a call to +sass+ inside a widget will fail unless you have already
  # installed the sass gem (e.g. "gem 'sass'" in your code or Gemfile).
  #
  # Current support is barebones. Please offer suggestions (or better
  # yet, patches) for whether and how to support, e.g., caching,
  # loading from files, precompilation, etc.
  #
  # It seems to me that SASS/SCSS should be part of the Page widget, which
  # would allow all the little style snippets to be compiled together
  # and appear in the document HEAD.
  module Sass
    def sass(arg, options = {})
      require "sass"
      options = {:cache => false}.merge(options)
      if arg =~ /[\w\.*]\.s?css/i
        options[:filename] = arg
        sass_text = File.read(arg)
      else
        sass_text = arg
      end
      style raw(::Sass.compile(sass_text, options))
    end

    def scss(arg, options = {})
      sass arg, {:syntax => :scss}.merge(options)
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
erector-rails4-0.2.0 lib/erector/sass.rb
erector-rails4-0.1.3 lib/erector/sass.rb
erector-rails4-0.1.2 lib/erector/sass.rb
erector-0.10.0 lib/erector/sass.rb
erector-rails4-0.1.1 lib/erector/sass.rb
erector-rails4-0.1.0 lib/erector/sass.rb
erector-rails4-0.0.7 lib/erector/sass.rb
erector-rails4-0.0.6 lib/erector/sass.rb
erector-rails4-0.0.5 lib/erector/sass.rb
erector-rails4-0.0.4 lib/erector/sass.rb
erector-rails4-0.0.3 lib/erector/sass.rb
erector-rails4-0.0.2 lib/erector/sass.rb
erector-rails4-0.0.1 lib/erector/sass.rb