dartsass-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f54418a3dfff076535f9245a15377196c955ef2f942d4596fda3445e77744b0f
4
+ data.tar.gz: 494d613cc196b8d8b18397bdfc16b8cd96ec6a52b4868c22b87e672bf33481a8
5
+ SHA512:
6
+ metadata.gz: f7d5a3709da49b5404220553893cae43e2ac8ca93073d93e5087fe5264518fede5d287a650de8204ef6d95ed3f58c02535f93fe4554427e64c4e8c1373159739
7
+ data.tar.gz: 9f5294028db7ad669ed0f0c33bac897712be5b7fc22cedd6ccd79bcb43d8b9bc56821ee85f95cb058bf8fc792574ce7befd704427354d2a0c7a5bfaccaad2a68
@@ -0,0 +1,26 @@
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/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2022 David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Dart Sass for Rails
2
+
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
+
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, Linux, and Windows. The Linux and Windows versions are the ones for 64-bit, and the macOS version is compiled for Intel but will run on ARM as well.
6
+
7
+ The installer will create your 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.
8
+
9
+ If you need to use a custom input or output file, you can run `bundle exec dartsass` to access the platform-specific executable, and give it your own build options.
10
+
11
+ When you're developing your application, you want to run Dart Sass in watch mode, so changes are automatically reflected in the generated CSS output. You can do this either by running `rails dartsass:watch` as a separate process, or by running `./bin/dev` which uses [foreman](https://github.com/ddollar/foreman) to starts both the Dart Sass watch process and the rails server in development mode.
12
+
13
+
14
+ ## Installation
15
+
16
+ 1. Run `./bin/bundle add dartsass-rails`
17
+ 2. Run `./bin/rails dartsass:install`
18
+
19
+
20
+ ## Building in production
21
+
22
+ The `dartsass:build` is automatically attached to `assets:precompile`, so before the asset pipeline digests the files, the Dart Sass output will be generated.
23
+
24
+
25
+ ## Version
26
+
27
+ Dart Sass 1.49.0
28
+
29
+
30
+ ## License
31
+
32
+ Dart Sass for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
33
+ Sass is released under the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require "bundler/setup"
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require "rake/testtask"
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ t.warning = true
12
+ end
13
+
14
+ task default: :test
data/exe/dartsass ADDED
@@ -0,0 +1,22 @@
1
+ #! /usr/bin/env ruby
2
+ # because rubygems shims assume a gem's executables are Ruby
3
+
4
+ require "shellwords"
5
+
6
+ os = Gem::Platform.local.os
7
+
8
+ exe_path =
9
+ case os
10
+ when "darwin" then File.join(__dir__, "darwin/sass")
11
+ when "linux" then File.join(__dir__, "linux/sass")
12
+ when "mingw32" then File.join(__dir__, "mingw32/sass.bat")
13
+ else
14
+ STDERR.puts(<<~ERRMSG)
15
+ ERROR: dartsass-rails does not support the #{os} operating system
16
+ ERRMSG
17
+ exit 1
18
+ end
19
+
20
+ command = Shellwords.join([ exe_path, ARGV ].flatten)
21
+ puts "+ #{command}"
22
+ exec(command)
@@ -0,0 +1,6 @@
1
+ require "rails"
2
+
3
+ module Dartsass
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module Dartsass
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,5 @@
1
+ module Dartsass
2
+ end
3
+
4
+ require "dartsass/version"
5
+ require "dartsass/engine"
@@ -0,0 +1,2 @@
1
+ web: bin/rails server -p 3000
2
+ css: bin/rails dartsass:watch
@@ -0,0 +1 @@
1
+ // Sassy
@@ -0,0 +1,32 @@
1
+ APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
2
+ CENTERING_CONTAINER_INSERTION_POINT = /^\s*<%= yield %>/.freeze
3
+
4
+ say "Build into app/assets/builds"
5
+ empty_directory "app/assets/builds"
6
+ keep_file "app/assets/builds"
7
+
8
+ if Rails.root.join(".gitignore").exist?
9
+ append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
10
+ end
11
+
12
+ unless Rails.root.join("app/assets/stylesheets/application.scss").exist?
13
+ say "Add default app/assets/stylesheets/application.scss"
14
+ copy_file "#{__dir__}/application.scss", "app/assets/stylesheets/application.scss"
15
+ end
16
+
17
+ if Rails.root.join("Procfile.dev").exist?
18
+ append_to_file "Procfile.dev", "css: bin/rails dartsass:watch\n"
19
+ else
20
+ say "Add default Procfile.dev"
21
+ copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"
22
+
23
+ say "Ensure foreman is installed"
24
+ run "gem install foreman"
25
+ end
26
+
27
+ say "Add bin/dev to start foreman"
28
+ copy_file "#{__dir__}/dev", "bin/dev"
29
+ chmod "bin/dev", 0755, verbose: false
30
+
31
+ say "Compile initial Dart Sass build"
32
+ run "rails dartsass:build"
data/lib/install/dev ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if ! command -v foreman &> /dev/null
4
+ then
5
+ echo "Installing foreman..."
6
+ gem install foreman
7
+ fi
8
+
9
+ foreman start -f Procfile.dev
@@ -0,0 +1,21 @@
1
+ DARTSASS_COMPILE_COMMAND = "#{Pathname.new(__dir__).to_s}/../../exe/dartsass #{Rails.root.join("app/assets/stylesheets/application.scss")} #{Rails.root.join("app/assets/builds/application.scss")}"
2
+
3
+ namespace :dartsass do
4
+ desc "Build your Dart Sass CSS"
5
+ task :build do
6
+ system DARTSASS_COMPILE_COMMAND
7
+ end
8
+
9
+ desc "Watch and build your Dart Sass CSS on file changes"
10
+ task :watch do
11
+ system "#{DARTSASS_COMPILE_COMMAND} -w"
12
+ end
13
+ end
14
+
15
+ Rake::Task["assets:precompile"].enhance(["dartsass:build"])
16
+
17
+ if Rake::Task.task_defined?("test:prepare")
18
+ Rake::Task["test:prepare"].enhance(["dartsass:build"])
19
+ elsif Rake::Task.task_defined?("db:test:prepare")
20
+ Rake::Task["db:test:prepare"].enhance(["dartsass:build"])
21
+ end
@@ -0,0 +1,8 @@
1
+ namespace :dartsass do
2
+ desc "Remove CSS builds"
3
+ task :clobber do
4
+ rm_rf Dir["app/assets/builds/[^.]*.css"], verbose: false
5
+ end
6
+ end
7
+
8
+ Rake::Task["assets:clobber"].enhance(["dartsass:clobber"])
@@ -0,0 +1,6 @@
1
+ namespace :dartsass do
2
+ desc "Install Dart Sass into the app"
3
+ task :install do
4
+ system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/dartsass.rb", __dir__)}"
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dartsass-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - David Heinemeier Hansson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 6.0.0
27
+ description:
28
+ email: david@hey.com
29
+ executables:
30
+ - dartsass
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE-DEPENDENCIES
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - exe/dartsass
39
+ - lib/dartsass-rails.rb
40
+ - lib/dartsass/engine.rb
41
+ - lib/dartsass/version.rb
42
+ - lib/install/Procfile.dev
43
+ - lib/install/application.scss
44
+ - lib/install/dartsass.rb
45
+ - lib/install/dev
46
+ - lib/tasks/build.rake
47
+ - lib/tasks/clobber.rake
48
+ - lib/tasks/install.rake
49
+ homepage: https://github.com/rails/dartsass-rails
50
+ licenses:
51
+ - MIT
52
+ metadata:
53
+ homepage_uri: https://github.com/rails/dartsass-rails
54
+ rubygems_mfa_required: 'true'
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubygems_version: 3.2.32
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Integrate Dart Sass with the asset pipeline in Rails.
74
+ test_files: []