Class: Sass::Compiler
- Inherits:
-
Object
- Object
- Sass::Compiler
- Defined in:
- lib/sass/compiler.rb,
lib/sass/compiler/host.rb,
lib/sass/compiler/varint.rb,
lib/sass/compiler/channel.rb,
lib/sass/compiler/connection.rb,
lib/sass/compiler/dispatcher.rb,
lib/sass/compiler/host/struct.rb,
lib/sass/compiler/host/protofier.rb,
lib/sass/compiler/host/logger_registry.rb,
lib/sass/compiler/host/function_registry.rb,
lib/sass/compiler/host/importer_registry.rb
Overview
A synchronous Compiler. Each compiler instance exposes the #compile and #compile_string methods within the lifespan of the compiler.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#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) ⇒ CompileResult
Compiles the Sass file at
pathto CSS. -
#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) ⇒ CompileResult
Compiles a stylesheet whose contents is
sourceto CSS. -
#info ⇒ String
Information about the Sass implementation.
-
#initialize ⇒ Compiler
constructor
A new instance of Compiler.
Constructor Details
#initialize ⇒ Compiler
Returns a new instance of Compiler.
33 34 35 |
# File 'lib/sass/compiler.rb', line 33 def initialize @channel = Channel.new end |
Instance Method Details
#close ⇒ Object
205 206 207 |
# File 'lib/sass/compiler.rb', line 205 def close @channel.close end |
#closed? ⇒ Boolean
209 210 211 |
# File 'lib/sass/compiler.rb', line 209 def closed? @channel.closed? end |
#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) ⇒ CompileResult
Compiles the Sass file at path to CSS.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/sass/compiler.rb', line 68 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 |
#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) ⇒ CompileResult
Compiles a stylesheet whose contents is source to CSS.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/sass/compiler.rb', line 148 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 |
#info ⇒ String
Returns Information about the Sass implementation.
198 199 200 201 202 203 |
# File 'lib/sass/compiler.rb', line 198 def info @info ||= [ ['sass-embedded', Embedded::VERSION, '(Embedded Host)', '[Ruby]'].join("\t"), Host.new(@channel).version_request.join("\t") ].join("\n").freeze end |