class Sass::Compiler

@see sass-lang.com/documentation/js-api/classes/compiler/
sass.close
result = sass.compile(‘style.scss’)
result = sass.compile_string(‘h1 { font-size: 40px; }’)
sass = Sass::Compiler.new
@example
Each compiler instance exposes the {#compile} and {#compile_string} methods within the lifespan of the compiler.
A synchronous {Compiler}.

def close

def close
  @channel.close
end

def closed?

def closed?
  @channel.closed?
end

def compile(path,

Other tags:
    See: https://sass-lang.com/documentation/js-api/functions/compile/ -

Raises:
  • (ArgumentError, CompileError, IOError) -

Returns:
  • (CompileResult) -

Parameters:
  • verbose (Boolean) -- By default, Dart Sass will print only five instances of the same deprecation warning per
  • silence_deprecations (Array) -- A set of active deprecations to ignore.
  • quiet_deps (Boolean) -- If this option is set to +true+, Sass won’t print warnings that are caused by
  • logger (Object) -- An object to use to handle warnings and/or debug messages from Sass.
  • future_deprecations (Array) -- A set of future deprecations to opt into early.
  • fatal_deprecations (Array) -- A set of deprecations to treat as fatal.
  • alert_color (Boolean) -- If this is +true+, the compiler will use ANSI color escape codes in its error and
  • alert_ascii (Boolean) -- If this is +true+, the compiler will exclusively use ASCII characters in its error
  • importers (Array) -- Custom importers that control how Sass resolves loads from rules like
  • functions (Hash) -- Additional built-in Sass functions that are available in all stylesheets.
  • style (Symbol) -- The OutputStyle of the compiled CSS.
  • source_map_include_sources (Boolean) -- Whether Sass should include the sources in the generated source map.
  • source_map (Boolean) -- Whether or not Sass should generate a source map.
  • charset (Boolean) -- By default, if the CSS document contains non-ASCII characters, Sass adds a +@charset+
  • load_paths (Array) -- Paths in which to look for stylesheets loaded by rules like
  • path (String) --
  • def compile(path,
                load_paths: [],
                charset: true,
                source_map: false,
                source_map_include_sources: false,
                style: :expanded,
                functions: {},
                importers: [],
                alert_ascii: false,
                alert_color: nil,
                fatal_deprecations: [],
                future_deprecations: [],
                logger: nil,
                quiet_deps: false,
                silence_deprecations: [],
                verbose: false)
      raise ArgumentError, 'path must be set' if path.nil?
      Host.new(@channel).compile_request(
        path:,
        source: nil,
        importer: nil,
        load_paths:,
        syntax: nil,
        url: nil,
        charset:,
        source_map:,
        source_map_include_sources:,
        style:,
        functions:,
        importers:,
        alert_color:,
        alert_ascii:,
        fatal_deprecations:,
        future_deprecations:,
        logger:,
        quiet_deps:,
        silence_deprecations:,
        verbose:
      )
    end

    def compile_string(source,

    Other tags:
      See: https://sass-lang.com/documentation/js-api/functions/compilestring/ -

    Raises:
    • (ArgumentError, CompileError, IOError) -

    Returns:
    • (CompileResult) -

    Parameters:
    • verbose (Boolean) -- By default, Dart Sass will print only five instances of the same deprecation warning per
    • silence_deprecations (Array) -- A set of active deprecations to ignore.
    • quiet_deps (Boolean) -- If this option is set to +true+, Sass won’t print warnings that are caused by
    • logger (Object) -- An object to use to handle warnings and/or debug messages from Sass.
    • future_deprecations (Array) -- A set of future deprecations to opt into early.
    • fatal_deprecations (Array) -- A set of deprecations to treat as fatal.
    • alert_color (Boolean) -- If this is +true+, the compiler will use ANSI color escape codes in its error and
    • alert_ascii (Boolean) -- If this is +true+, the compiler will exclusively use ASCII characters in its error
    • importers (Array) -- Custom importers that control how Sass resolves loads from rules like
    • functions (Hash) -- Additional built-in Sass functions that are available in all stylesheets.
    • style (Symbol) -- The OutputStyle of the compiled CSS.
    • source_map_include_sources (Boolean) -- Whether Sass should include the sources in the generated source map.
    • source_map (Boolean) -- Whether or not Sass should generate a source map.
    • charset (Boolean) -- By default, if the CSS document contains non-ASCII characters, Sass adds a +@charset+
    • url (String) -- The canonical URL of the entrypoint stylesheet. If this is passed along with +importer+, it's
    • syntax (Symbol) -- The Syntax to use to parse the entrypoint stylesheet.
    • load_paths (Array) -- Paths in which to look for stylesheets loaded by rules like
    • importer (Object) -- The importer to use to handle loads that are relative to the entrypoint stylesheet.
    • source (String) --
    • def compile_string(source,
                         importer: nil,
                         load_paths: [],
                         syntax: :scss,
                         url: nil,
                         charset: true,
                         source_map: false,
                         source_map_include_sources: false,
                         style: :expanded,
                         functions: {},
                         importers: [],
                         alert_ascii: false,
                         alert_color: nil,
                         fatal_deprecations: [],
                         future_deprecations: [],
                         logger: nil,
                         quiet_deps: false,
                         silence_deprecations: [],
                         verbose: false)
        raise ArgumentError, 'source must be set' if source.nil?
        Host.new(@channel).compile_request(
          path: nil,
          source:,
          importer:,
          load_paths:,
          syntax:,
          url:,
          charset:,
          source_map:,
          source_map_include_sources:,
          style:,
          functions:,
          importers:,
          alert_color:,
          alert_ascii:,
          fatal_deprecations:,
          future_deprecations:,
          logger:,
          quiet_deps:,
          silence_deprecations:,
          verbose:
        )
      end

      def info

      Other tags:
        See: https://sass-lang.com/documentation/js-api/variables/info/ -

      Returns:
      • (String) - Information about the Sass implementation.
      def info
        @info ||= [
          ['sass-embedded', Embedded::VERSION, '(Embedded Host)', '[Ruby]'].join("\t"),
          Host.new(@channel).version_request.join("\t")
        ].join("\n").freeze
      end

      def initialize

      def initialize
        @channel = Channel.new(Dispatcher)
      end