dartsass-rails 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63c02e6013b5cc320cc16b785bfde748ed62b4c7131381a0b20094671a3e60e2
4
- data.tar.gz: 97f292bf59c8d746cd8d3234496d04e235ccebf2ffeb5561070cfd40b95c8c48
3
+ metadata.gz: 8bee8507190c1b8fef63816699f2174316cb9b96de4fc1d6ce4a733b73f9334e
4
+ data.tar.gz: 29b2d2b7eed2bb31222f1d589bba04e9e6f7726c2ed1d0b7db82b5db91a41382
5
5
  SHA512:
6
- metadata.gz: 6df4dbdbe880d4bda7d6f70d2dbe2393efcde5ab03677c1ab914d0307515b48324d7b249fdd394abc23ba8141f587b2f3bd2e29961854b055b78c1408c91a414
7
- data.tar.gz: 107198c8ec71b941ab26d2f6071b192e459a1f0bf0fbca47b8ec59b2a12c7f7aff4e638f789e7b8eb93c10746be0aa3eaa94de653bd099d6741ed15ea78ea0d7
6
+ metadata.gz: a0f2b2541a72fb15f85e3d11801cd16aea6b972f6253f1399aece4dcc6e77567e734267aa011de2e645dd28de1540f2f68252ae593815eb2a7a0f0a88d0f6217
7
+ data.tar.gz: 24165e161833a474acf36ed4ad2c866397f64a524bbd70640b3ec167083575dd65e2ce094afa53e5bf9562a84526b8b80cc010bc220c5d4e86f4640d5e06ded6
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Sass](https://sass-lang.com) is a stylesheet language that’s compiled to CSS. It allows you to use variables, nested rules, mixins, functions, and more, all with a fully CSS-compatible syntax.
4
4
 
5
- This gem wraps [the standalone executable version](https://github.com/sass/dart-sass/releases) of the Dart version of Sass. These executables are platform specific, but included in this gem are the ones for macOS (Intel, Apple Silicon), Linux (x86-64, AArch64), and Windows (x86-64).
5
+ This gem wraps [the standalone executable version](https://github.com/sass/dart-sass/releases) of the Dart version of Sass. The platform specific Dart Sass executables are distributed by [sass-embedded](https://rubygems.org/gems/sass-embedded) gem.
6
6
 
7
7
  The installer will create your default Sass input file in `app/assets/stylesheets/application.scss`. This is where you should import all the style files to be compiled [using the @use rule](https://sass-lang.com/documentation/at-rules/use). When you run `rails dartsass:build`, this input file will be used to generate the output in `app/assets/builds/application.css`. That's the output CSS that you'll include in your app. The load path for Sass is automatically configured to be `app/assets/stylesheets`.
8
8
 
@@ -35,13 +35,22 @@ Rails.application.config.dartsass.builds = {
35
35
 
36
36
  The hash key is the relative path to a Sass file in `app/assets/stylesheets/` and the hash value will be the name of the file output to `app/assets/builds/`.
37
37
 
38
+ If both the hash key and the hash value are directories instead of files, it configures a directory to directory compliation, which compiles all public Sass files whose filenames do not start with underscore (`_`).
39
+
40
+ ```ruby
41
+ # config/initializers/dartsass.rb
42
+ Rails.application.config.dartsass.builds = {
43
+ "." => "."
44
+ }
45
+ ```
46
+
38
47
  ## Configuring build options
39
48
 
40
- By default, sass is invoked with `--style=compressed --no-source-map`. You can adjust these options by overwriting `Rails.application.config.dartsass.build_options`.
49
+ By default, sass is invoked with `["--style=compressed", "--no-source-map"]`. You can adjust these options by overwriting `Rails.application.config.dartsass.build_options`.
41
50
 
42
51
  ```ruby
43
52
  # config/initializers/dartsass.rb
44
- Rails.application.config.dartsass.build_options << " --quiet-deps"
53
+ Rails.application.config.dartsass.build_options << "--no-charset" << "--quiet-deps"
45
54
  ```
46
55
 
47
56
  ## Importing assets from gems
@@ -106,7 +115,7 @@ the Dart Sass process is most likely not running.
106
115
 
107
116
  ##### Solution
108
117
 
109
- Make sure the Dart Sass process is running by starting the Rails sever by
118
+ Make sure the Dart Sass process is running by starting the Rails server by
110
119
  running: `./bin/dev`.
111
120
 
112
121
  #### Running continuous integration pipelines
@@ -123,8 +132,9 @@ the following command: `bundle exec rails dartsass:build`.
123
132
 
124
133
  ## Version
125
134
 
126
- Dart Sass 1.49.0
127
-
135
+ ``` sh
136
+ bundle exec dartsass --version
137
+ ```
128
138
 
129
139
  ## License
130
140
 
data/exe/dartsass CHANGED
@@ -1,26 +1,4 @@
1
1
  #! /usr/bin/env ruby
2
- # because rubygems shims assume a gem's executables are Ruby
2
+ # frozen_string_literal: true
3
3
 
4
- require "shellwords"
5
- require "rbconfig"
6
-
7
- system_config = RbConfig::CONFIG
8
- platform_string = "#{system_config["host_cpu"]}-#{system_config["host_os"]}"
9
-
10
- exe_path =
11
- case platform_string
12
- when /aarch64-linux/ then File.join(__dir__, "aarch64-linux/sass")
13
- when /arm(64)?-darwin/ then File.join(__dir__, "arm64-darwin/sass")
14
- when /darwin/ then File.join(__dir__, "darwin/sass")
15
- when /linux/ then File.join(__dir__, "linux/sass")
16
- when /mswin|mingw|cygwin/ then File.join(__dir__, "mingw32/sass.bat")
17
- else
18
- STDERR.puts(<<~ERRMSG)
19
- ERROR: dartsass-rails does not support the #{platform_string} platform
20
- ERRMSG
21
- exit 1
22
- end
23
-
24
- command = Shellwords.join([ exe_path, ARGV ].flatten)
25
- puts "+ #{command}"
26
- exec(command)
4
+ load Gem.bin_path("sass-embedded", "sass")
@@ -4,6 +4,6 @@ module Dartsass
4
4
  class Engine < ::Rails::Engine
5
5
  config.dartsass = ActiveSupport::OrderedOptions.new
6
6
  config.dartsass.builds = { "application.scss" => "application.css" }
7
- config.dartsass.build_options = "--style=compressed --no-source-map"
7
+ config.dartsass.build_options = ["--style=compressed", "--no-source-map"]
8
8
  end
9
9
  end
@@ -0,0 +1,27 @@
1
+ module Dartsass
2
+ module Runner
3
+ EXEC_PATH = "#{Pathname.new(__dir__).to_s}/../../exe/dartsass"
4
+ CSS_LOAD_PATH = Rails.root.join("app/assets/stylesheets")
5
+ CSS_BUILD_PATH = Rails.root.join("app/assets/builds")
6
+
7
+ module_function
8
+
9
+ def dartsass_build_mapping
10
+ Rails.application.config.dartsass.builds.map { |input, output|
11
+ "#{CSS_LOAD_PATH.join(input)}:#{CSS_BUILD_PATH.join(output)}"
12
+ }
13
+ end
14
+
15
+ def dartsass_build_options
16
+ Rails.application.config.dartsass.build_options.flat_map(&:split)
17
+ end
18
+
19
+ def dartsass_load_paths
20
+ [ CSS_LOAD_PATH ].concat(Rails.application.config.assets.paths).flat_map { |path| ["--load-path", path.to_s] }
21
+ end
22
+
23
+ def dartsass_compile_command
24
+ [ RbConfig.ruby, EXEC_PATH ].concat(dartsass_build_options).concat(dartsass_load_paths).concat(dartsass_build_mapping)
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module Dartsass
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -32,7 +32,7 @@ else
32
32
  end
33
33
 
34
34
  say "Add bin/dev to start foreman"
35
- copy_file "#{__dir__}/dev", "bin/dev"
35
+ copy_file "#{__dir__}/dev", "bin/dev", force: true
36
36
  chmod "bin/dev", 0755, verbose: false
37
37
 
38
38
  say "Compile initial Dart Sass build"
data/lib/tasks/build.rake CHANGED
@@ -1,41 +1,23 @@
1
- EXEC_PATH = "#{Pathname.new(__dir__).to_s}/../../exe/dartsass"
2
- CSS_LOAD_PATH = Rails.root.join("app/assets/stylesheets")
3
- CSS_BUILD_PATH = Rails.root.join("app/assets/builds")
4
-
5
- def dartsass_build_mapping
6
- Rails.application.config.dartsass.builds.map { |input, output|
7
- "#{Shellwords.escape(CSS_LOAD_PATH.join(input))}:#{Shellwords.escape(CSS_BUILD_PATH.join(output))}"
8
- }.join(" ")
9
- end
10
-
11
- def dartsass_build_options
12
- Rails.application.config.dartsass.build_options
13
- end
14
-
15
- def dartsass_load_paths
16
- [ CSS_LOAD_PATH ].concat(Rails.application.config.assets.paths).map { |path| "--load-path #{Shellwords.escape(path)}" }.join(" ")
17
- end
18
-
19
- def dartsass_compile_command
20
- "#{EXEC_PATH} #{dartsass_build_options} #{dartsass_load_paths} #{dartsass_build_mapping}"
21
- end
1
+ require "dartsass/runner"
22
2
 
23
3
  namespace :dartsass do
24
4
  desc "Build your Dart Sass CSS"
25
5
  task build: :environment do
26
- system dartsass_compile_command, exception: true
6
+ system(*Dartsass::Runner.dartsass_compile_command, exception: true)
27
7
  end
28
8
 
29
9
  desc "Watch and build your Dart Sass CSS on file changes"
30
10
  task watch: :environment do
31
- system "#{dartsass_compile_command} -w", exception: true
11
+ system(*Dartsass::Runner.dartsass_compile_command, "--watch", exception: true)
32
12
  end
33
13
  end
34
14
 
35
- Rake::Task["assets:precompile"].enhance(["dartsass:build"])
15
+ unless ENV["SKIP_CSS_BUILD"]
16
+ Rake::Task["assets:precompile"].enhance(["dartsass:build"])
36
17
 
37
- if Rake::Task.task_defined?("test:prepare")
38
- Rake::Task["test:prepare"].enhance(["dartsass:build"])
39
- elsif Rake::Task.task_defined?("db:test:prepare")
40
- Rake::Task["db:test:prepare"].enhance(["dartsass:build"])
18
+ if Rake::Task.task_defined?("test:prepare")
19
+ Rake::Task["test:prepare"].enhance(["dartsass:build"])
20
+ elsif Rake::Task.task_defined?("db:test:prepare")
21
+ Rake::Task["db:test:prepare"].enhance(["dartsass:build"])
22
+ end
41
23
  end
@@ -1,8 +1,8 @@
1
1
  namespace :dartsass do
2
2
  desc "Remove CSS builds"
3
3
  task :clobber do
4
- rm_rf Dir["app/assets/builds/[^.]*.css"], verbose: false
5
- rm_rf Dir["app/assets/builds/[^.]*.css\.map"], verbose: false
4
+ rm_rf Dir["app/assets/builds/**/[^.]*.css"], verbose: false
5
+ rm_rf Dir["app/assets/builds/**/[^.]*.css\.map"], verbose: false
6
6
  end
7
7
  end
8
8
 
@@ -1,6 +1,6 @@
1
1
  namespace :dartsass do
2
2
  desc "Install Dart Sass into the app"
3
3
  task :install do
4
- system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/dartsass.rb", __dir__)}", exception: true
4
+ system RbConfig.ruby, "./bin/rails", "app:template", "LOCATION=#{File.expand_path("../install/dartsass.rb", __dir__)}", exception: true
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dartsass-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-16 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 6.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: sass-embedded
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.63'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.63'
27
41
  description:
28
42
  email: david@hey.com
29
43
  executables:
@@ -31,25 +45,13 @@ executables:
31
45
  extensions: []
32
46
  extra_rdoc_files: []
33
47
  files:
34
- - LICENSE-DEPENDENCIES
35
48
  - MIT-LICENSE
36
49
  - README.md
37
50
  - Rakefile
38
- - exe/aarch64-linux/sass
39
- - exe/arm64-darwin/sass
40
51
  - exe/dartsass
41
- - exe/darwin/LICENSE
42
- - exe/darwin/sass
43
- - exe/darwin/src/dart
44
- - exe/darwin/src/sass.snapshot
45
- - exe/linux/LICENSE
46
- - exe/linux/sass
47
- - exe/mingw32/LICENSE
48
- - exe/mingw32/sass.bat
49
- - exe/mingw32/src/dart.exe
50
- - exe/mingw32/src/sass.snapshot
51
52
  - lib/dartsass-rails.rb
52
53
  - lib/dartsass/engine.rb
54
+ - lib/dartsass/runner.rb
53
55
  - lib/dartsass/version.rb
54
56
  - lib/install/Procfile.dev
55
57
  - lib/install/application.scss
@@ -79,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
81
  - !ruby/object:Gem::Version
80
82
  version: '0'
81
83
  requirements: []
82
- rubygems_version: 3.3.26
84
+ rubygems_version: 3.5.11
83
85
  signing_key:
84
86
  specification_version: 4
85
87
  summary: Integrate Dart Sass with the asset pipeline in Rails.
data/LICENSE-DEPENDENCIES DELETED
@@ -1,26 +0,0 @@
1
- dartsass-rails redistributes executables from the https://github.com/sass/dart-sass/ project
2
-
3
- The license for that software can be found at https://github.com/sass/dart-sass/blob/main/LICENSE which is reproduced here for your convenience:
4
-
5
- Copyright (c) 2016, Google Inc.
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining
8
- a copy of this software and associated documentation files (the
9
- "Software"), to deal in the Software without restriction, including
10
- without limitation the rights to use, copy, modify, merge, publish,
11
- distribute, sublicense, and/or sell copies of the Software, and to
12
- permit persons to whom the Software is furnished to do so, subject to
13
- the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be
16
- included in all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
-
26
- Licenses for individual platform binaries are available under exe/[platform]/LICENSE
Binary file
Binary file