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 +4 -4
- data/README.md +16 -6
- data/exe/dartsass +2 -24
- data/lib/dartsass/engine.rb +1 -1
- data/lib/dartsass/runner.rb +27 -0
- data/lib/dartsass/version.rb +1 -1
- data/lib/install/dartsass.rb +1 -1
- data/lib/tasks/build.rake +10 -28
- data/lib/tasks/clobber.rake +2 -2
- data/lib/tasks/install.rake +1 -1
- metadata +18 -16
- data/LICENSE-DEPENDENCIES +0 -26
- data/exe/aarch64-linux/sass +0 -0
- data/exe/arm64-darwin/sass +0 -0
- data/exe/darwin/LICENSE +0 -1531
- data/exe/darwin/sass +0 -17
- data/exe/darwin/src/dart +0 -0
- data/exe/darwin/src/sass.snapshot +0 -0
- data/exe/linux/LICENSE +0 -1531
- data/exe/linux/sass +0 -0
- data/exe/mingw32/LICENSE +0 -1531
- data/exe/mingw32/sass.bat +0 -7
- data/exe/mingw32/src/dart.exe +0 -0
- data/exe/mingw32/src/sass.snapshot +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bee8507190c1b8fef63816699f2174316cb9b96de4fc1d6ce4a733b73f9334e
|
4
|
+
data.tar.gz: 29b2d2b7eed2bb31222f1d589bba04e9e6f7726c2ed1d0b7db82b5db91a41382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
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
|
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
|
-
|
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
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
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")
|
data/lib/dartsass/engine.rb
CHANGED
@@ -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
|
data/lib/dartsass/version.rb
CHANGED
data/lib/install/dartsass.rb
CHANGED
data/lib/tasks/build.rake
CHANGED
@@ -1,41 +1,23 @@
|
|
1
|
-
|
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
|
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
|
11
|
+
system(*Dartsass::Runner.dartsass_compile_command, "--watch", exception: true)
|
32
12
|
end
|
33
13
|
end
|
34
14
|
|
35
|
-
|
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
|
-
|
39
|
-
elsif Rake::Task.task_defined?("db:test:prepare")
|
40
|
-
|
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
|
data/lib/tasks/clobber.rake
CHANGED
@@ -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
|
5
|
-
rm_rf Dir["app/assets/builds
|
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
|
|
data/lib/tasks/install.rake
CHANGED
@@ -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
|
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
|
+
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:
|
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.
|
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
|
data/exe/aarch64-linux/sass
DELETED
Binary file
|
data/exe/arm64-darwin/sass
DELETED
Binary file
|