Class: Jekyll::Converters::Scss

### Home Classes Methods

### In Files

- lib/jekyll/converters/scss.rb

### Parent

Converter

### Methods

- #allow_caching?
- #convert
- #jekyll_sass_configuration
- #matches
- #output_ext
- #safe?
- #sass_build_configuration_options
- #sass_configs
- #sass_dir
- #sass_dir_relative_to_site_source
- #sass_load_paths
- #sass_style
- #syntax
- #user_sass_load_paths

### Class/Module Index

Quicksearch

- Jekyll
- Jekyll::Converters
- Jekyll::Converters::Sass
- Jekyll::Converters::Scss
- JekyllSassConverter

No matching classes.

# Jekyll::Converters::Scss

### Constants

ALLOWED_STYLES
SyntaxError

### Public Instance Methods

allow_caching?() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 82
    def allow_caching?
      !safe?
    end

convert(content) click to toggle source

    # File lib/jekyll/converters/scss.rb, line 94
    def convert(content)
      ::Sass.compile(content, sass_configs)
    rescue ::Sass::SyntaxError => e
      raise SyntaxError.new("#{e.to_s} on line #{e.sass_line}")
    end

jekyll_sass_configuration() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 26
    def jekyll_sass_configuration
      options = @config["sass"] || {}
      unless options["style"].nil?
        options["style"] = options["style"].to_s.gsub(/\A:/, '').to_sym
      end
      options
    end

matches(ext) click to toggle source

    # File lib/jekyll/converters/scss.rb, line 14
    def matches(ext)
      ext =~ /^\.scss$/
    end

output_ext(ext) click to toggle source

    # File lib/jekyll/converters/scss.rb, line 18
    def output_ext(ext)
      ".css"
    end

safe?() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 22
    def safe?
      !!@config["safe"]
    end

sass_build_configuration_options(overrides) click to toggle source

    # File lib/jekyll/converters/scss.rb, line 34
    def sass_build_configuration_options(overrides)
      if safe?
        {
          :load_paths => sass_load_paths,
          :syntax     => syntax,
          :style      => sass_style,
          :cache      => false
        }
      else
        Jekyll::Utils.symbolize_hash_keys(
          Jekyll::Utils.deep_merge_hashes(
            jekyll_sass_configuration,
            overrides
          )
        )
      end
    end

sass_configs() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 86
    def sass_configs
      sass_build_configuration_options({
        "syntax"     => syntax,
        "cache"      => allow_caching?,
        "load_paths" => sass_load_paths
      })
    end

sass_dir() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 56
    def sass_dir
      return "_sass" if jekyll_sass_configuration["sass_dir"].to_s.empty?
      jekyll_sass_configuration["sass_dir"]
    end

sass_dir_relative_to_site_source() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 70
    def sass_dir_relative_to_site_source
      Jekyll.sanitized_path(@config["source"], sass_dir)
    end

sass_load_paths() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 74
    def sass_load_paths
      if safe?
        [sass_dir_relative_to_site_source]
      else
        (user_sass_load_paths + [sass_dir_relative_to_site_source]).uniq
      end.select { |load_path| File.directory?(load_path) }
    end

sass_style() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 61
    def sass_style
      style = jekyll_sass_configuration.fetch("style", :compact)
      ALLOWED_STYLES.include?(style.to_s) ? style.to_sym : :compact
    end

syntax() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 52
    def syntax
      :scss
    end

user_sass_load_paths() click to toggle source

    # File lib/jekyll/converters/scss.rb, line 66
    def user_sass_load_paths
      Array(jekyll_sass_configuration["load_paths"])
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.