dartsass-rails 0.5.0 → 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: c00e94e064e218058760b98dc11cab24ca2b6fedecd673d5a7a5ad17d2cd97c4
4
- data.tar.gz: 649b361c576c944ade9830dbc06d39bb9b0be78a3d85f4f3e20fbd7c8d4dec8c
3
+ metadata.gz: 8bee8507190c1b8fef63816699f2174316cb9b96de4fc1d6ce4a733b73f9334e
4
+ data.tar.gz: 29b2d2b7eed2bb31222f1d589bba04e9e6f7726c2ed1d0b7db82b5db91a41382
5
5
  SHA512:
6
- metadata.gz: 86341084eddd19bcaca06bf7a350e7d6140afe57d1aeaf1b235de3c041be489570d3317b62451d2f42b93c4678c3fe95db5809f44aea4f43ff0f4de862d9ad33
7
- data.tar.gz: e9712ed6ebf4f956229d825b7d98b4e6cda1d72afaad7335a31d43b47b937cd0cd31a102c4d9197be64099fe9a94c335a43087706d9ff3c8a81970653187cd9b
6
+ metadata.gz: a0f2b2541a72fb15f85e3d11801cd16aea6b972f6253f1399aece4dcc6e77567e734267aa011de2e645dd28de1540f2f68252ae593815eb2a7a0f0a88d0f6217
7
+ data.tar.gz: 24165e161833a474acf36ed4ad2c866397f64a524bbd70640b3ec167083575dd65e2ce094afa53e5bf9562a84526b8b80cc010bc220c5d4e86f4640d5e06ded6
data/README.md CHANGED
@@ -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
@@ -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.5.0"
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.5.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: 2023-06-18 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
@@ -51,6 +51,7 @@ files:
51
51
  - exe/dartsass
52
52
  - lib/dartsass-rails.rb
53
53
  - lib/dartsass/engine.rb
54
+ - lib/dartsass/runner.rb
54
55
  - lib/dartsass/version.rb
55
56
  - lib/install/Procfile.dev
56
57
  - lib/install/application.scss
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  - !ruby/object:Gem::Version
81
82
  version: '0'
82
83
  requirements: []
83
- rubygems_version: 3.4.10
84
+ rubygems_version: 3.5.11
84
85
  signing_key:
85
86
  specification_version: 4
86
87
  summary: Integrate Dart Sass with the asset pipeline in Rails.