Module: Sass
- Defined in:
- lib/sass.rb,
lib/sass/css.rb,
lib/sass/exec.rb,
lib/sass/repl.rb,
lib/sass/root.rb,
lib/sass/scss.rb,
lib/sass/util.rb,
lib/sass/error.rb,
lib/sass/stack.rb,
lib/sass/engine.rb,
lib/sass/logger.rb,
lib/sass/plugin.rb,
lib/sass/script.rb,
lib/sass/shared.rb,
lib/sass/scss/rx.rb,
lib/sass/version.rb,
lib/sass/features.rb,
lib/sass/selector.rb,
lib/sass/callbacks.rb,
lib/sass/importers.rb,
lib/sass/tree/node.rb,
lib/sass/util/test.rb,
lib/sass/deprecation.rb,
lib/sass/environment.rb,
lib/sass/plugin/rack.rb,
lib/sass/scss/parser.rb,
lib/sass/cache_stores.rb,
lib/sass/script/lexer.rb,
lib/sass/script/parser.rb,
lib/sass/importers/base.rb,
lib/sass/tree/root_node.rb,
lib/sass/tree/warn_node.rb,
lib/sass/scss/css_parser.rb,
lib/sass/selector/pseudo.rb,
lib/sass/selector/simple.rb,
lib/sass/tree/debug_node.rb,
lib/sass/tree/error_node.rb,
lib/sass/util/subset_map.rb,
lib/sass/logger/log_level.rb,
lib/sass/script/css_lexer.rb,
lib/sass/tree/import_node.rb,
lib/sass/tree/return_node.rb,
lib/sass/cache_stores/base.rb,
lib/sass/cache_stores/null.rb,
lib/sass/script/css_parser.rb,
lib/sass/selector/sequence.rb,
lib/sass/tree/at_root_node.rb,
lib/sass/tree/content_node.rb,
lib/sass/cache_stores/chain.rb,
lib/sass/scss/static_parser.rb,
lib/sass/tree/function_node.rb,
lib/sass/tree/variable_node.rb,
lib/sass/cache_stores/memory.rb,
lib/sass/tree/mixin_def_node.rb,
lib/sass/util/normalized_map.rb,
lib/sass/importers/filesystem.rb,
lib/sass/plugin/configuration.rb,
lib/sass/cache_stores/filesystem.rb,
lib/sass/selector/comma_sequence.rb,
lib/sass/plugin/staleness_checker.rb,
lib/sass/selector/simple_sequence.rb,
lib/sass/importers/deprecated_path.rb,
lib/sass/selector/abstract_sequence.rb
Overview
The module that contains everything Sass-related:
- Engine is the class used to render Sass/SCSS within Ruby code.
- Plugin is interfaces with web frameworks (Rails and Merb in particular).
- SyntaxError is raised when Sass encounters an error.
- CSS handles conversion of CSS to Sass.
Also see the full Sass reference.
Defined Under Namespace
Modules: CacheStores, Callbacks, Exec, Features, Importers, Logger, Media, Plugin, SCSS, Script, Selector, Shared, Source, Supports, Tree, Util, Version Classes: BaseEnvironment, CSS, Callable, Deprecation, Engine, Environment, ReadOnlyEnvironment, Repl, SemiGlobalEnvironment, Stack, SyntaxError, UnitConversionError
Constant Summary collapse
- 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.
File.expand_path(File.join(__FILE__, "../../.."))
- VERSION =
A string representing the version of Sass. A more fine-grained representation is available from Sass.version.
- MERB_LOADED =
true
- RAILS_LOADED =
true
- GENERIC_LOADED =
true
Constants included from Features
Class Method Summary collapse
-
.compile(contents, options = {})
Compile a Sass or SCSS string to CSS.
-
.compile_file(filename, *args)
Compile a file on disk to CSS.
-
.load_paths ⇒ Array<String, Pathname, Sass::Importers::Base>
The global load paths for Sass files.
- .logger
- .logger=(l)
Methods included from Version
Methods included from Features
Class Method Details
.compile(contents, options = {})
Compile a Sass or SCSS string to CSS. Defaults to SCSS.
55 56 57 58 |
# File 'lib/sass.rb', line 55
def self.compile(contents, options = {})
options[:syntax] ||= :scss
Engine.new(contents, options).to_css
end
|
.compile_file(filename, options = {}) ⇒ String .compile_file(filename, css_filename, options = {})
Compile a file on disk to CSS.
82 83 84 85 86 87 88 89 90 91 92 93 |
# 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 ⇒ Array<String, Pathname, Sass::Importers::Base>
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 Engine.
They are lower-precedence than any load paths passed in via the
: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.
37 38 39 40 41 42 43 |
# 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
|
.logger
13 14 15 |
# File 'lib/sass/logger.rb', line 13
def logger
Thread.current[:sass_logger] ||= Sass::Logger::Base.new
end
|
.logger=(l)
9 10 11 |
# File 'lib/sass/logger.rb', line 9
def logger=(l)
Thread.current[:sass_logger] = l
end
|