Module: Sass

Defined in:
lib/sass.rb,
lib/sass/logger.rb,
lib/sass/embedded.rb,
lib/sass/importer.rb,
lib/sass/compile_error.rb,
lib/sass/embedded/util.rb,
lib/sass/file_importer.rb,
lib/sass/compile_result.rb,
lib/sass/embedded/error.rb,
lib/sass/embedded/result.rb,
lib/sass/importer_result.rb,
lib/sass/embedded/channel.rb,
lib/sass/embedded/version.rb,
lib/sass/embedded/compiler.rb,
lib/sass/embedded/observer.rb,
lib/sass/embedded/platform.rb,
lib/sass/embedded_protocol.rb,
lib/sass/logger/source_span.rb,
lib/sass/embedded/compiler/path.rb,
lib/sass/logger/source_location.rb,
lib/sass/embedded/compile_context.rb,
lib/sass/embedded/version_context.rb,
lib/sass/embedded/compiler/requirements.rb,
ext/sass/extconf.rb

Overview

The Sass module. This communicates with Embedded Dart Sass using the Embedded Sass protocol.

Defined Under Namespace

Modules: EmbeddedProtocol, Logger Classes: CompileError, CompileResult, Embedded, FileImporter, Importer, ImporterResult

Class Method Summary collapse

Class Method Details

.compile(path, **kwargs) ⇒ CompileResult

The global compile method. This instantiates a global Embedded instance and calls Sass::Embedded#compile.

See Sass::Embedded#compile for supported options.

Examples:

Sass.compile('style.css')

Returns:

Raises:


19
20
21
# File 'lib/sass.rb', line 19

def compile(path, **kwargs)
  instance.compile(path, **kwargs)
end

.compile_string(source, **kwargs) ⇒ CompileResult

The global compile_string method. This instantiates a global Embedded instance and calls Sass::Embedded#compile_string.

See Sass::Embedded#compile_string for supported options.

Examples:

Sass.compile_string('h1 { font-size: 40px; }')

Returns:

Raises:


33
34
35
# File 'lib/sass.rb', line 33

def compile_string(source, **kwargs)
  instance.compile_string(source, **kwargs)
end

.include_pathsArray

Deprecated.

The global include_paths for Sass files. This is meant for plugins and libraries to register the paths to their Sass stylesheets to that they may be included via `@import` or `@use`. This include path is used by every instance of Embedded. They are lower-precedence than any include paths passed in via the `include_paths` option.

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

Examples:

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

Returns:

  • (Array)

52
53
54
# File 'lib/sass.rb', line 52

def include_paths
  Embedded.include_paths
end

.infoObject

The global info method. This instantiates a global Embedded instance and calls Sass::Embedded#info.

Raises:

  • (ProtocolError)

60
61
62
# File 'lib/sass.rb', line 60

def info
  instance.info
end

.render(**kwargs) ⇒ Result

Deprecated.

The global render method. This instantiates a global Embedded instance and calls Sass::Embedded#render.

See README for supported options.

Examples:

Sass.render(data: 'h1 { font-size: 40px; }')
Sass.render(file: 'style.css')

Returns:

  • (Result)

Raises:

  • (ProtocolError)
  • (RenderError)

77
78
79
# File 'lib/sass.rb', line 77

def render(**kwargs)
  instance.render(**kwargs)
end