Module: Sass

### Home Classes Methods

### In Files

- lib/sass.rb
- lib/sass/cache_stores.rb
- lib/sass/cache_stores/base.rb
- lib/sass/cache_stores/chain.rb
- lib/sass/cache_stores/filesystem.rb
- lib/sass/cache_stores/memory.rb
- lib/sass/cache_stores/null.rb
- lib/sass/callbacks.rb
- lib/sass/css.rb
- lib/sass/engine.rb
- lib/sass/environment.rb
- lib/sass/error.rb
- lib/sass/exec.rb
- lib/sass/features.rb
- lib/sass/importers.rb
- lib/sass/importers/base.rb
- lib/sass/importers/filesystem.rb
- lib/sass/logger.rb
- lib/sass/logger/log_level.rb
- lib/sass/plugin.rb
- lib/sass/plugin/configuration.rb
- lib/sass/plugin/rack.rb
- lib/sass/plugin/staleness_checker.rb
- lib/sass/repl.rb
- lib/sass/root.rb
- lib/sass/script.rb
- lib/sass/script/css_lexer.rb
- lib/sass/script/css_parser.rb
- lib/sass/script/lexer.rb
- lib/sass/script/parser.rb
- lib/sass/scss.rb
- lib/sass/scss/css_parser.rb
- lib/sass/scss/parser.rb
- lib/sass/scss/rx.rb
- lib/sass/scss/script_lexer.rb
- lib/sass/scss/script_parser.rb
- lib/sass/scss/static_parser.rb
- lib/sass/selector.rb
- lib/sass/selector/abstract_sequence.rb
- lib/sass/selector/comma_sequence.rb
- lib/sass/selector/pseudo.rb
- lib/sass/selector/sequence.rb
- lib/sass/selector/simple.rb
- lib/sass/selector/simple_sequence.rb
- lib/sass/shared.rb
- lib/sass/stack.rb
- lib/sass/tree/at_root_node.rb
- lib/sass/tree/content_node.rb
- lib/sass/tree/debug_node.rb
- lib/sass/tree/error_node.rb
- lib/sass/tree/function_node.rb
- lib/sass/tree/import_node.rb
- lib/sass/tree/mixin_def_node.rb
- lib/sass/tree/node.rb
- lib/sass/tree/return_node.rb
- lib/sass/tree/root_node.rb
- lib/sass/tree/variable_node.rb
- lib/sass/tree/warn_node.rb
- lib/sass/util/cross_platform_random.rb
- lib/sass/util/normalized_map.rb
- lib/sass/util/subset_map.rb
- lib/sass/util/test.rb
- lib/sass/version.rb

### Namespace

- MODULE Sass::CacheStores
- MODULE Sass::Callbacks
- MODULE Sass::Exec
- MODULE Sass::Features
- MODULE Sass::Importers
- MODULE Sass::Logger
- MODULE Sass::Media
- MODULE Sass::Plugin
- MODULE Sass::SCSS
- MODULE Sass::Script
- MODULE Sass::Selector
- MODULE Sass::Shared
- MODULE Sass::Source
- MODULE Sass::Supports
- MODULE Sass::Tree
- MODULE Sass::Util
- MODULE Sass::Version
- CLASS Sass::BaseEnvironment
- CLASS Sass::CSS
- CLASS Sass::Engine
- CLASS Sass::Environment
- CLASS Sass::ReadOnlyEnvironment
- CLASS Sass::Repl
- CLASS Sass::SemiGlobalEnvironment
- CLASS Sass::Stack
- CLASS Sass::SyntaxError
- CLASS Sass::UnitConversionError

### Methods

- ::compile
- ::compile_file
- ::load_paths

### Class/Module Index

Quicksearch

- Sass
- Sass::BaseEnvironment
- Sass::CSS
- Sass::CacheStores
- Sass::CacheStores::Base
- Sass::CacheStores::Chain
- Sass::CacheStores::Filesystem
- Sass::CacheStores::Memory
- Sass::CacheStores::Null
- Sass::Callbacks
- Sass::Callbacks::InstanceMethods
- Sass::Engine
- Sass::Engine::Line
- Sass::Environment
- Sass::Exec
- Sass::Exec::Base
- Sass::Exec::SassConvert
- Sass::Exec::SassScss
- Sass::Exec::SassScss::Sass::Plugin.compiler
- Sass::Features
- Sass::Importers
- Sass::Importers::Base
- Sass::Importers::Filesystem
- Sass::Logger
- Sass::Logger::Base
- Sass::Logger::LogLevel
- Sass::Logger::LogLevel::ClassMethods
- Sass::Media
- Sass::Media::Query
- Sass::Media::QueryList
- Sass::Plugin
- Sass::Plugin::Compiler
- Sass::Plugin::Configuration
- Sass::Plugin::MerbBootLoader
- Sass::Plugin::Rack
- Sass::Plugin::StalenessChecker
- Sass::ReadOnlyEnvironment
- Sass::Repl
- Sass::SCSS
- Sass::SCSS::CssParser
- Sass::SCSS::Parser
- Sass::SCSS::RX
- Sass::SCSS::ScriptLexer
- Sass::SCSS::ScriptParser
- Sass::SCSS::StaticParser
- Sass::Script
- Sass::Script::CssLexer
- Sass::Script::CssParser
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::Lexer
- Sass::Script::Parser
- Sass::Script::Tree
- Sass::Script::Tree::Funcall
- Sass::Script::Tree::Interpolation
- Sass::Script::Tree::ListLiteral
- Sass::Script::Tree::Literal
- Sass::Script::Tree::MapLiteral
- Sass::Script::Tree::Node
- Sass::Script::Tree::Operation
- Sass::Script::Tree::Selector
- Sass::Script::Tree::StringInterpolation
- Sass::Script::Tree::UnaryOperation
- Sass::Script::Tree::Variable
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::Bool
- Sass::Script::Value::Color
- Sass::Script::Value::Helpers
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Script::Value::Null
- Sass::Script::Value::Number
- Sass::Selector
- Sass::Selector::AbstractSequence
- Sass::Selector::Attribute
- Sass::Selector::Class
- Sass::Selector::CommaSequence
- Sass::Selector::Element
- Sass::Selector::Id
- Sass::Selector::Parent
- Sass::Selector::Placeholder
- Sass::Selector::Pseudo
- Sass::Selector::Sequence
- Sass::Selector::Simple
- Sass::Selector::SimpleSequence
- Sass::Selector::Universal
- Sass::SemiGlobalEnvironment
- Sass::Shared
- Sass::Source
- Sass::Source::Map
- Sass::Source::Map::Mapping
- Sass::Source::Position
- Sass::Source::Range
- Sass::Stack
- Sass::Stack::Frame
- Sass::Supports
- Sass::Supports::Condition
- Sass::Supports::Declaration
- Sass::Supports::Interpolation
- Sass::Supports::Negation
- Sass::Supports::Operator
- Sass::SyntaxError
- Sass::Tree
- Sass::Tree::AtRootNode
- Sass::Tree::CharsetNode
- Sass::Tree::CommentNode
- Sass::Tree::ContentNode
- Sass::Tree::CssImportNode
- Sass::Tree::DebugNode
- Sass::Tree::DirectiveNode
- Sass::Tree::EachNode
- Sass::Tree::ErrorNode
- Sass::Tree::ExtendNode
- Sass::Tree::ForNode
- Sass::Tree::FunctionNode
- Sass::Tree::IfNode
- Sass::Tree::ImportNode
- Sass::Tree::KeyframeRuleNode
- Sass::Tree::MediaNode
- Sass::Tree::MixinDefNode
- Sass::Tree::MixinNode
- Sass::Tree::Node
- Sass::Tree::PropNode
- Sass::Tree::ReturnNode
- Sass::Tree::RootNode
- Sass::Tree::RuleNode
- Sass::Tree::SupportsNode
- Sass::Tree::TraceNode
- Sass::Tree::VariableNode
- Sass::Tree::Visitors
- Sass::Tree::Visitors::Base
- Sass::Tree::Visitors::CheckNesting
- Sass::Tree::Visitors::Convert
- Sass::Tree::Visitors::Cssize
- Sass::Tree::Visitors::Cssize::Bubble
- Sass::Tree::Visitors::DeepCopy
- Sass::Tree::Visitors::Extend
- Sass::Tree::Visitors::Perform
- Sass::Tree::Visitors::SetOptions
- Sass::Tree::Visitors::ToCss
- Sass::Tree::WarnNode
- Sass::Tree::WhileNode
- Sass::UnitConversionError
- Sass::Util
- Sass::Util::CrossPlatformRandom
- Sass::Util::MultibyteStringScanner
- Sass::Util::NormalizedMap
- Sass::Util::SubsetMap
- Sass::Util::Test
- Sass::Version
- ActionController
- ActionController::Base
- Object
- OrderedHash

No matching classes.

# Sass

The module that contains everything Sass-related:

- {Sass::Engine} is the class used to render Sass/SCSS within Ruby code.

- {Sass::Plugin} is interfaces with web frameworks (Rails and Merb in particular).

- {Sass::SyntaxError} is raised when Sass encounters an error.

- {Sass::CSS} handles conversion of CSS to Sass.

Also see the {file:SASS_REFERENCE.md full Sass reference}.

### Constants

Callable

  A Sass mixin or function.

  `name`: `String` : The name of the mixin/function.

  `args`: `Array<(Script::Tree::Node, Script::Tree::Node)>` : The arguments for the mixin/function.

      Each element is a tuple containing the variable node of the argument
      and the parse tree for the default value of the argument.

  `splat`: `Script::Tree::Node?` : The variable node of the splat argument for this callable, or null.

  `environment`: {Sass::Environment} : The environment in which the mixin/function was defined.

      This is captured so that the mixin/function can have access
      to local variables defined in its scope.

  `tree`: `Array<Tree::Node>` : The parse tree for the mixin/function.

  `has_content`: `Boolean` : Whether the callable accepts a content block.

  `type`: `String` : The user-friendly name of the type of the callable.

ROOT_DIR

  The root directory of the Sass source tree. This may be overridden by the package manager if the lib directory is separated from the main source tree. @api public

VERSION

  A string representing the version of Sass. A more fine-grained representation is available from Sass.version. @api public

### Attributes

logger[RW]
tests_running[RW]

@private

### Public Class Methods

compile(contents, options = {}) click to toggle source

Compile a Sass or SCSS string to CSS. Defaults to SCSS.

@param contents [String] The contents of the Sass file. @param options [{Symbol => Object}] An options hash;

    see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}

@raise [Sass::SyntaxError] if there's an error in the document @raise [Encoding::UndefinedConversionError] if the source encoding

    cannot be converted to UTF-8

@raise [ArgumentError] if the document uses an unknown encoding with `@charset`

    # File lib/sass.rb, line 55
    def self.compile(contents, options = {})
      options[:syntax] ||= :scss
      Engine.new(contents, options).to_css
    end

compile_file(filename, *args) click to toggle source

Compile a file on disk to CSS.

@raise [Sass::SyntaxError] if there's an error in the document @raise [Encoding::UndefinedConversionError] if the source encoding

    cannot be converted to UTF-8

@raise [ArgumentError] if the document uses an unknown encoding with `@charset`

@overload compile_file(filename, options = {})

    Return the compiled CSS rather than writing it to a file.

    @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
    @param options [{Symbol => Object}] An options hash;
      see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
    @return [String] The compiled CSS.

@overload compile_file(filename, css_filename, options = {})

    Write the compiled CSS to a file.

    @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
    @param options [{Symbol => Object}] An options hash;
      see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
    @param css_filename [String] The location to which to write the compiled CSS.

    # File lib/sass.rb, line 82
    def self.compile_file(filename, *args)
      options = args.last.is_a?(Hash) ? args.pop : {}
      css_filename = args.shift
      result = Sass::Engine.for_file(filename, options).render
      if css_filename
        options[:css_filename] ||= css_filename
        open(css_filename, "w") {|css_file| css_file.write(result)}
        nil
      else
        result
      end
    end

load_paths() click to toggle source

The global load paths for Sass files. This is meant for plugins and libraries to register the paths to their Sass stylesheets to that they may be `@imported`. This load path is used by every instance of {Sass::Engine}. They are lower-precedence than any load paths passed in via the {file:SASS_REFERENCE.md#load_paths-option `:load_paths` option}.

If the `SASS_PATH` environment variable is set, the initial value of `load_paths` will be initialized based on that. The variable should be a colon-separated list of path names (semicolon-separated on Windows).

Note that files on the global load path are never compiled to CSS themselves, even if they aren't partials. They exist only to be imported.

@example

    Sass.load_paths << File.dirname(__FILE__ + '/sass')

@return [Array<String, Pathname, Sass::Importers::Base>]

    # File lib/sass.rb, line 37
    def self.load_paths
      @load_paths ||= if ENV['SASS_PATH']
                        ENV['SASS_PATH'].split(Sass::Util.windows? ? ';' : ':')
                      else
                        []
                      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.