sass-embedded 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9f113d7bb15374cf348bfb8bdfd7d1d349251a122b1e153b48f97bf2b61f438
4
- data.tar.gz: 9f0898214fe9abef5c49009a2a190385e90c40896235b46ff4a4c023ca6f2798
3
+ metadata.gz: 29224ce0b935055ad1b8a1bea0f0177d0c80ec51edcbf9fc6ad31036cbf93e30
4
+ data.tar.gz: 88ccf669d8cc196923c5dbbf3c488be00b22b39a6b59e18bad5bd3b3b6292981
5
5
  SHA512:
6
- metadata.gz: 69444e33879b691226abcf732bc27d63276af27c2ecab0aaa394bfd6e80090916259dc6ae7accf1a23e1ca904b11a5257ecca52fad4daabcf3d19cb2b70df916
7
- data.tar.gz: aa119cd52f0c334cddcbdce5be6cc6b3a17a88472e1de50136c5ee4f17194c661f4965ae272449694cf4db94ba713b26355a3c17f4a993f9dc13eeff5be77f78
6
+ metadata.gz: 8bfc272b296c6182dd638bc68864b8e1cdfee4f3fc3f5983ec3a870fe2506c30af87ef5477f2f62ef384ec2a22686971ed3941a74134335ecb5e47a951b45a4c
7
+ data.tar.gz: 49d1c4cae407da60e0831eefcce86522e5cb3403aef1d20bbc7d4cb093c814472a9143b043fee3293a18042e6464aa5195d279eef0eac21e2ce7bb5783652636
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Embedded Sass Host for Ruby
2
2
 
3
- [![build](https://github.com/ntkme/embedded-host-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ntkme/embedded-host-ruby/actions/workflows/build.yml)
3
+ [![build](https://github.com/ntkme/sass-embedded-host-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ntkme/sass-embedded-host-ruby/actions/workflows/build.yml)
4
4
  [![gem](https://badge.fury.io/rb/sass-embedded.svg)](https://rubygems.org/gems/sass-embedded)
5
5
 
6
6
  This is a Ruby library that implements the host side of the [Embedded Sass protocol](https://github.com/sass/sass-embedded-protocol).
@@ -20,7 +20,7 @@ The Ruby API provides two entrypoints for compiling Sass to CSS.
20
20
  - `Sass.compile` takes a path to a Sass file and return the result of compiling that file to CSS.
21
21
 
22
22
  ``` ruby
23
- require 'sass'
23
+ require 'sass-embedded'
24
24
 
25
25
  result = Sass.compile('style.scss')
26
26
  puts result.css
@@ -29,7 +29,7 @@ puts result.css
29
29
  - `Sass.compile_string` takes a string that represents the contents of a Sass file and return the result of compiling that file to CSS.
30
30
 
31
31
  ``` ruby
32
- require 'sass'
32
+ require 'sass-embedded'
33
33
 
34
34
  result = Sass.compile_string('h1 { font-size: 40px; }')
35
35
  puts result.css
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  class Embedded
5
- VERSION = '1.1.2'
5
+ VERSION = '1.2.0'
6
6
  end
7
7
  end
data/lib/sass/embedded.rb CHANGED
@@ -16,7 +16,58 @@ require_relative 'embedded/version'
16
16
  require_relative 'logger'
17
17
  require_relative 'value'
18
18
 
19
+ # The Sass module.
20
+ #
21
+ # This communicates with Embedded Dart Sass using the Embedded Sass protocol.
22
+ #
23
+ # @example
24
+ # Sass.compile('style.scss')
25
+ #
26
+ # @example
27
+ # Sass.compile_string('h1 { font-size: 40px; }')
19
28
  module Sass
29
+ class << self
30
+ # Compiles the Sass file at +path+ to CSS.
31
+ # @param (see Embedded#compile)
32
+ # @return (see Embedded#compile)
33
+ # @raise (see Embedded#compile)
34
+ # @see Embedded#compile
35
+ def compile(path, **kwargs)
36
+ instance.compile(path, **kwargs)
37
+ end
38
+
39
+ # Compiles a stylesheet whose contents is +source+ to CSS.
40
+ # @param (see Embedded#compile_string)
41
+ # @return (see Embedded#compile_string)
42
+ # @raise (see Embedded#compile_string)
43
+ # @see Embedded#compile_string
44
+ def compile_string(source, **kwargs)
45
+ instance.compile_string(source, **kwargs)
46
+ end
47
+
48
+ # @param (see Embedded#info)
49
+ # @return (see Embedded#info)
50
+ # @raise (see Embedded#info)
51
+ # @see Embedded#info
52
+ def info
53
+ instance.info
54
+ end
55
+
56
+ private
57
+
58
+ def instance
59
+ if defined? @instance
60
+ @instance = Embedded.new if @instance.closed?
61
+ else
62
+ @instance = Embedded.new
63
+ at_exit do
64
+ @instance.close
65
+ end
66
+ end
67
+ @instance
68
+ end
69
+ end
70
+
20
71
  # The {Embedded} host for using dart-sass-embedded. Each instance creates
21
72
  # its own communication {Channel} with a dedicated compiler process.
22
73
  #
data/lib/sass-embedded.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'sass'
4
+ require_relative 'sass/embedded'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-19 00:00:00.000000000 Z
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -123,7 +123,6 @@ files:
123
123
  - ext/sass/package.json
124
124
  - ext/sass/unzip.vbs
125
125
  - lib/sass-embedded.rb
126
- - lib/sass.rb
127
126
  - lib/sass/compile_error.rb
128
127
  - lib/sass/compile_result.rb
129
128
  - lib/sass/embedded.rb
@@ -160,8 +159,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
160
159
  licenses:
161
160
  - MIT
162
161
  metadata:
163
- documentation_uri: https://rubydoc.info/gems/sass-embedded/1.1.2
164
- source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.1.2
162
+ documentation_uri: https://rubydoc.info/gems/sass-embedded/1.2.0
163
+ source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.2.0
165
164
  funding_uri: https://github.com/sponsors/ntkme
166
165
  post_install_message:
167
166
  rdoc_options: []
data/lib/sass.rb DELETED
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'sass/embedded'
4
-
5
- # The Sass module.
6
- #
7
- # This communicates with Embedded Dart Sass using the Embedded Sass protocol.
8
- #
9
- # @example
10
- # Sass.compile('style.scss')
11
- #
12
- # @example
13
- # Sass.compile_string('h1 { font-size: 40px; }')
14
- module Sass
15
- class << self
16
- # Compiles the Sass file at +path+ to CSS.
17
- # @param (see Embedded#compile)
18
- # @return (see Embedded#compile)
19
- # @raise (see Embedded#compile)
20
- # @see Embedded#compile
21
- def compile(path, **kwargs)
22
- instance.compile(path, **kwargs)
23
- end
24
-
25
- # Compiles a stylesheet whose contents is +source+ to CSS.
26
- # @param (see Embedded#compile_string)
27
- # @return (see Embedded#compile_string)
28
- # @raise (see Embedded#compile_string)
29
- # @see Embedded#compile_string
30
- def compile_string(source, **kwargs)
31
- instance.compile_string(source, **kwargs)
32
- end
33
-
34
- # @param (see Embedded#info)
35
- # @return (see Embedded#info)
36
- # @raise (see Embedded#info)
37
- # @see Embedded#info
38
- def info
39
- instance.info
40
- end
41
-
42
- private
43
-
44
- def instance
45
- if defined? @instance
46
- @instance = Embedded.new if @instance.closed?
47
- else
48
- @instance = Embedded.new
49
- at_exit do
50
- @instance.close
51
- end
52
- end
53
- @instance
54
- end
55
- end
56
- end