Embed sassc-rails
This commit is contained in:
parent
1aa9618b85
commit
2a3f5104a2
31 changed files with 833 additions and 0 deletions
17
debian/gems-compat/sassc-rails-2.1.2/.gitignore
vendored
Normal file
17
debian/gems-compat/sassc-rails-2.1.2/.gitignore
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/.bundle/
|
||||
/.yardoc
|
||||
/Gemfile.lock
|
||||
/gemfiles/*.lock
|
||||
/_yardoc/
|
||||
/coverage/
|
||||
/doc/
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
tmp/
|
||||
*.bundle
|
||||
*.so
|
||||
*.o
|
||||
*.a
|
||||
mkmf.log
|
||||
vendor
|
||||
*.log
|
31
debian/gems-compat/sassc-rails-2.1.2/.travis.yml
vendored
Normal file
31
debian/gems-compat/sassc-rails-2.1.2/.travis.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
language: ruby
|
||||
|
||||
bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
|
||||
|
||||
script: "bundle exec rake test"
|
||||
|
||||
before_install:
|
||||
- rvm @global do gem uninstall bundler -x
|
||||
- gem install bundler --version '< 2'
|
||||
|
||||
gemfile:
|
||||
- gemfiles/sprockets-rails_3_0.gemfile
|
||||
- gemfiles/sprockets-rails_2_3.gemfile
|
||||
- gemfiles/sprockets_3_0.gemfile
|
||||
- gemfiles/sprockets_4_0.gemfile
|
||||
- gemfiles/rails_4_2.gemfile
|
||||
- gemfiles/rails_5_2.gemfile
|
||||
|
||||
rvm:
|
||||
- 2.4.6
|
||||
- 2.5.5
|
||||
- 2.6.3
|
||||
- jruby
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- gemfile: gemfiles/rails_4_2.gemfile
|
||||
rvm: jruby
|
||||
|
||||
notifications:
|
||||
email: false
|
10
debian/gems-compat/sassc-rails-2.1.2/CODE_OF_CONDUCT.md
vendored
Normal file
10
debian/gems-compat/sassc-rails-2.1.2/CODE_OF_CONDUCT.md
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
Sass is more than a technology; Sass is driven by the community of individuals
|
||||
that power its development and use every day. As a community, we want to embrace
|
||||
the very differences that have made our collaboration so powerful, and work
|
||||
together to provide the best environment for learning, growing, and sharing of
|
||||
ideas. It is imperative that we keep Sass a fun, welcoming, challenging, and
|
||||
fair place to play.
|
||||
|
||||
[The full community guidelines can be found on the Sass website.][link]
|
||||
|
||||
[link]: https://sass-lang.com/community-guidelines
|
7
debian/gems-compat/sassc-rails-2.1.2/Gemfile
vendored
Normal file
7
debian/gems-compat/sassc-rails-2.1.2/Gemfile
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
# for working locally
|
||||
# gem "sassc", :path => "../sassc"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec
|
22
debian/gems-compat/sassc-rails-2.1.2/LICENSE.txt
vendored
Normal file
22
debian/gems-compat/sassc-rails-2.1.2/LICENSE.txt
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2015 Ryan Boland
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
124
debian/gems-compat/sassc-rails-2.1.2/README.md
vendored
Normal file
124
debian/gems-compat/sassc-rails-2.1.2/README.md
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
# SassC::Rails [![Build Status](https://travis-ci.org/sass/sassc-rails.svg)](https://travis-ci.org/sass/sassc-rails) [![Gem Version](https://badge.fury.io/rb/sassc-rails.svg)](http://badge.fury.io/rb/sassc-rails)
|
||||
|
||||
We all love working with Sass, but compilation can take quite a long time for larger
|
||||
codebases. This gem integrates the C implementation of Sass,
|
||||
[LibSass](https://github.com/sass/libsass), into the asset pipeline.
|
||||
|
||||
In one larger project, this made compilation 4x faster:
|
||||
|
||||
```
|
||||
# Using sassc-rails
|
||||
|
||||
[1] pry(main)> Benchmark.bm { |bm| bm.report { Rails.application.assets["application.css"] } }
|
||||
user system total real
|
||||
1.720000 0.170000 1.890000 ( 1.936867)
|
||||
|
||||
# Using sass-rails
|
||||
|
||||
[1] pry(main)> Benchmark.bm { |bm| bm.report { Rails.application.assets["application.css"] } }
|
||||
user system total real
|
||||
7.820000 0.250000 8.070000 ( 8.106347)
|
||||
```
|
||||
|
||||
This should essentially be a drop in alternative to [sass-rails](https://github.com/rails/sass-rails).
|
||||
|
||||
## Inline Source Maps
|
||||
|
||||
With SassC-Rails, it's also extremely easy to turn on inline source maps. Simply
|
||||
add the following configuration to your development.rb file:
|
||||
|
||||
```ruby
|
||||
# config/environments/development.rb
|
||||
config.sass.inline_source_maps = true
|
||||
```
|
||||
|
||||
After adding this config line, you may need to clear your assets cache
|
||||
(`rm -r tmp/cache/assets`), stop spring, and restart your rails server. You may
|
||||
also wish to disable line comments (`config.sass.line_comments = false`).
|
||||
|
||||
Note, as indicated, these source maps are *inline*. They will not generate additional
|
||||
files or anything like that. Instead, they will be appended to the compiled
|
||||
application.css file.
|
||||
|
||||
## LibSass Compatibility With Ruby Sass
|
||||
|
||||
For a look at the compatibility between Ruby Sass and LibSass, check this
|
||||
[compatibility chart](http://sass-compatibility.github.io/) out.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Add this line to your application's Gemfile:
|
||||
|
||||
```ruby
|
||||
gem 'sassc-rails'
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
$ bundle
|
||||
|
||||
## Common Issues
|
||||
|
||||
### Deployment to Heroku
|
||||
|
||||
Due to LibSass compilation requirements, you must upgrade to the
|
||||
[Heroku Cedar-14 Stack](https://devcenter.heroku.com/articles/cedar-14-migration)
|
||||
in order to successfully install this gem.
|
||||
|
||||
Upgrading to Cedar-14 is usually a painless process.
|
||||
|
||||
|
||||
### Installing alongside a gem that depends on Sass-Rails
|
||||
|
||||
Libraries explicitly depending on Sass-Rails, such as ActiveAdmin, can cause
|
||||
conflicts with installation of SassC-Rails. While we have no built-in solution
|
||||
for this, please check out [this issue](https://github.com/sass/sassc-rails/issues/6)
|
||||
for a workaround.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
This gem is based on [sass-rails](https://github.com/rails/sass-rails), and
|
||||
is maintained by [Ryan Boland](https://ryanboland.com) and [awesome contributors](https://github.com/sass/sassc-rails/graphs/contributors).
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
- **2.1.2**
|
||||
- [Correct reference to SassC::Script::Value::String](https://github.com/sass/sassc-rails/pull/129)
|
||||
- **2.1.1**
|
||||
- [Fix Scaffolding](https://github.com/sass/sassc-rails/pull/119)
|
||||
- **2.1.0**
|
||||
- [JRuby support](https://github.com/sass/sassc-rails/pull/113)
|
||||
- [SCSS / SASS scaffolding](https://github.com/sass/sassc-rails/pull/112)
|
||||
- **2.0.0**
|
||||
- [Drop support for Sprockets 2](https://github.com/sass/sassc-rails/pull/109)
|
||||
- [Remove dependency on Ruby Sass](https://github.com/sass/sassc-rails/pull/109)
|
||||
- **1.3.0**
|
||||
- [Silence Sprockets deprecation warnings](https://github.com/sass/sassc-rails/pull/76)
|
||||
- [Sprockets 4 compatibility](https://github.com/sass/sassc-rails/pull/65)
|
||||
- **1.2.1**
|
||||
- Bump SassC (and thus LibSass) version
|
||||
- **1.2.0**
|
||||
- [Support sprockets-rails 3](https://github.com/sass/sassc-rails/pull/41)
|
||||
- [Only depend on Railties instead of full Rails](https://github.com/sass/sassc-rails/pull/52)
|
||||
- **1.1.0**
|
||||
- Moved under the official sass organization!
|
||||
- [Source line comments](https://github.com/sass/sassc-rails/pull/24) (`app.config.sass.line_comments`)
|
||||
- [Prevent sass-rails railtie from running](https://github.com/sass/sassc-rails/pull/34)
|
||||
- [CSS compression may be disabled in test mode](https://github.com/sass/sassc-rails/issues/33). Special thanks to [this Sass-Rails PR](https://github.com/rails/sass-rails/pull/338) for inspiration.
|
||||
- **1.0.0**
|
||||
- Initial Release
|
||||
- Add support for inline source maps
|
||||
- Support compression in the way that Sass-Rails handles it
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork it ( https://github.com/sass/sassc-rails/fork )
|
||||
1. Create your feature branch (`git checkout -b my-new-feature`)
|
||||
1. Commit your changes (`git commit -am 'Add some feature'`)
|
||||
1. Add Tests
|
||||
1. Push to the branch (`git push origin my-new-feature`)
|
||||
1. Create a new Pull Request
|
33
debian/gems-compat/sassc-rails-2.1.2/Rakefile
vendored
Normal file
33
debian/gems-compat/sassc-rails-2.1.2/Rakefile
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
require "bundler/gem_tasks"
|
||||
|
||||
task :test do
|
||||
$LOAD_PATH.unshift('lib', 'test')
|
||||
Dir.glob('./test/**/*_test.rb') { |f| require f }
|
||||
end
|
||||
task :default => [:test]
|
||||
|
||||
namespace :tests do
|
||||
gemfiles = %w[
|
||||
sprockets-rails_3_0
|
||||
sprockets-rails_2_3
|
||||
sprockets_3_0
|
||||
sprockets_4_0
|
||||
rails_4_2
|
||||
rails_5_2
|
||||
]
|
||||
|
||||
gemfiles.each do |gemfile|
|
||||
desc "Run tests against #{gemfile}"
|
||||
task gemfile do
|
||||
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle install"
|
||||
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake test"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run tests against all common asset pipeline setups"
|
||||
task :all do
|
||||
gemfiles.each do |gemfile|
|
||||
Rake::Task["tests:#{gemfile}"].invoke
|
||||
end
|
||||
end
|
||||
end
|
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/rails_4_2.gemfile
vendored
Normal file
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/rails_4_2.gemfile
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem "rails", "~> 4.2.0"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec path: "../"
|
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/rails_5_2.gemfile
vendored
Normal file
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/rails_5_2.gemfile
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem "rails", "~> 5.2.1"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec path: "../"
|
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets-rails_2_3.gemfile
vendored
Normal file
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets-rails_2_3.gemfile
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem "sprockets-rails", "~> 2.3.3"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec path: "../"
|
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets-rails_3_0.gemfile
vendored
Normal file
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets-rails_3_0.gemfile
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem "sprockets-rails", "~> 3.0.0"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec path: "../"
|
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets_3_0.gemfile
vendored
Normal file
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets_3_0.gemfile
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem "sprockets", "~> 3.0.3"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec path: "../"
|
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets_4_0.gemfile
vendored
Normal file
6
debian/gems-compat/sassc-rails-2.1.2/gemfiles/sprockets_4_0.gemfile
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem "sprockets", "~> 4.0.x"
|
||||
|
||||
# Specify your gem's dependencies in sassc-rails.gemspec
|
||||
gemspec path: "../"
|
13
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/sass/assets/assets_generator.rb
vendored
Normal file
13
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/sass/assets/assets_generator.rb
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "rails/generators/named_base"
|
||||
|
||||
module Sass
|
||||
module Generators
|
||||
class AssetsGenerator < ::Rails::Generators::NamedBase
|
||||
source_root File.expand_path("../templates", __FILE__)
|
||||
|
||||
def copy_sass
|
||||
template "stylesheet.sass", File.join('app/assets/stylesheets', class_path, "#{file_name}.sass")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the <%= name %> controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass here: https://sass-lang.com/
|
|
@ -0,0 +1,9 @@
|
|||
require "rails/generators/sass_scaffold"
|
||||
|
||||
module Sass
|
||||
module Generators
|
||||
class ScaffoldGenerator < ::Sass::Generators::ScaffoldBase
|
||||
def syntax() :sass end
|
||||
end
|
||||
end
|
||||
end
|
15
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/sass_scaffold.rb
vendored
Normal file
15
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/sass_scaffold.rb
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
require "sassc/engine"
|
||||
require "rails/generators/named_base"
|
||||
|
||||
module Sass
|
||||
module Generators
|
||||
class ScaffoldBase < ::Rails::Generators::NamedBase
|
||||
def copy_stylesheet
|
||||
dir = ::Rails::Generators::ScaffoldGenerator.source_root
|
||||
file = File.join(dir, "scaffold.css")
|
||||
converted_contents = ::SassC::Engine.new(File.read(file)).render
|
||||
create_file "app/assets/stylesheets/scaffolds.#{syntax}", converted_contents
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
13
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/scss/assets/assets_generator.rb
vendored
Normal file
13
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/scss/assets/assets_generator.rb
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "rails/generators/named_base"
|
||||
|
||||
module Scss
|
||||
module Generators
|
||||
class AssetsGenerator < ::Rails::Generators::NamedBase
|
||||
source_root File.expand_path("../templates", __FILE__)
|
||||
|
||||
def copy_scss
|
||||
template "stylesheet.scss", File.join('app/assets/stylesheets', class_path, "#{file_name}.scss")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the <%= name %> controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
10
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/scss/scaffold/scaffold_generator.rb
vendored
Normal file
10
debian/gems-compat/sassc-rails-2.1.2/lib/rails/generators/scss/scaffold/scaffold_generator.rb
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
require "rails/generators/sass_scaffold"
|
||||
|
||||
module Scss
|
||||
module Generators
|
||||
class ScaffoldGenerator < ::Sass::Generators::ScaffoldBase
|
||||
def syntax() :scss end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
4
debian/gems-compat/sassc-rails-2.1.2/lib/sassc-rails.rb
vendored
Normal file
4
debian/gems-compat/sassc-rails-2.1.2/lib/sassc-rails.rb
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "sassc/rails"
|
||||
|
10
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails.rb
vendored
Normal file
10
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails.rb
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative "rails/version"
|
||||
|
||||
require "sassc"
|
||||
require_relative "rails/functions"
|
||||
require_relative "rails/importer"
|
||||
require_relative "rails/template"
|
||||
require_relative "rails/compressor"
|
||||
require_relative "rails/railtie"
|
34
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb
vendored
Normal file
34
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'sprockets/sass_compressor'
|
||||
require 'securerandom'
|
||||
|
||||
class Sprockets::SassCompressor
|
||||
def initialize(options = {})
|
||||
@options = {
|
||||
syntax: :scss,
|
||||
cache: false,
|
||||
read_cache: false,
|
||||
style: :compressed
|
||||
}.merge(options).freeze
|
||||
@cache_key = SecureRandom.uuid
|
||||
end
|
||||
|
||||
def call(*args)
|
||||
input = if defined?(data)
|
||||
data # sprockets 2.x
|
||||
else
|
||||
args[0][:data] #sprockets 3.x
|
||||
end
|
||||
|
||||
SassC::Engine.new(
|
||||
input,
|
||||
{
|
||||
style: :compressed
|
||||
}
|
||||
).render
|
||||
end
|
||||
|
||||
# sprockets 2.x
|
||||
alias :evaluate :call
|
||||
end
|
13
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/functions.rb
vendored
Normal file
13
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/functions.rb
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'sprockets/sass_functions'
|
||||
|
||||
module Sprockets
|
||||
module SassFunctions
|
||||
def asset_data_url(path)
|
||||
::SassC::Script::Value::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
::SassC::Script::Functions.send :include, Sprockets::SassFunctions
|
181
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/importer.rb
vendored
Normal file
181
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/importer.rb
vendored
Normal file
|
@ -0,0 +1,181 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'tilt'
|
||||
|
||||
module SassC
|
||||
module Rails
|
||||
class Importer < SassC::Importer
|
||||
class Extension
|
||||
attr_reader :postfix
|
||||
|
||||
def initialize(postfix=nil)
|
||||
@postfix = postfix
|
||||
end
|
||||
|
||||
def import_for(full_path, parent_dir, options)
|
||||
SassC::Importer::Import.new(full_path)
|
||||
end
|
||||
end
|
||||
|
||||
class CSSExtension
|
||||
def postfix
|
||||
".css"
|
||||
end
|
||||
|
||||
def import_for(full_path, parent_dir, options)
|
||||
import_path = full_path.gsub(/\.css$/,"")
|
||||
SassC::Importer::Import.new(import_path)
|
||||
end
|
||||
end
|
||||
|
||||
class CssScssExtension < Extension
|
||||
def postfix
|
||||
".css.scss"
|
||||
end
|
||||
|
||||
def import_for(full_path, parent_dir, options)
|
||||
source = File.open(full_path, 'rb') { |f| f.read }
|
||||
SassC::Importer::Import.new(full_path, source: source)
|
||||
end
|
||||
end
|
||||
|
||||
class CssSassExtension < Extension
|
||||
def postfix
|
||||
".css.sass"
|
||||
end
|
||||
|
||||
def import_for(full_path, parent_dir, options)
|
||||
sass = File.open(full_path, 'rb') { |f| f.read }
|
||||
parsed_scss = SassC::Sass2Scss.convert(sass)
|
||||
SassC::Importer::Import.new(full_path, source: parsed_scss)
|
||||
end
|
||||
end
|
||||
|
||||
class SassERBExtension < Extension
|
||||
def postfix
|
||||
".sass.erb"
|
||||
end
|
||||
|
||||
def import_for(full_path, parent_dir, options)
|
||||
template = Tilt::ERBTemplate.new(full_path)
|
||||
parsed_erb = template.render(options[:sprockets][:context], {})
|
||||
parsed_scss = SassC::Sass2Scss.convert(parsed_erb)
|
||||
SassC::Importer::Import.new(full_path, source: parsed_scss)
|
||||
end
|
||||
end
|
||||
|
||||
class ERBExtension < Extension
|
||||
def import_for(full_path, parent_dir, options)
|
||||
template = Tilt::ERBTemplate.new(full_path)
|
||||
parsed_erb = template.render(options[:sprockets][:context], {})
|
||||
SassC::Importer::Import.new(full_path, source: parsed_erb)
|
||||
end
|
||||
end
|
||||
|
||||
EXTENSIONS = [
|
||||
CssScssExtension.new,
|
||||
CssSassExtension.new,
|
||||
SassERBExtension.new,
|
||||
ERBExtension.new(".scss.erb"),
|
||||
ERBExtension.new(".css.erb"),
|
||||
Extension.new(".scss"),
|
||||
Extension.new(".sass"),
|
||||
CSSExtension.new
|
||||
].freeze
|
||||
|
||||
PREFIXS = [ "", "_" ]
|
||||
GLOB = /(\A|\/)(\*|\*\*\/\*)\z/
|
||||
|
||||
def imports(path, parent_path)
|
||||
parent_dir, _ = File.split(parent_path)
|
||||
specified_dir, specified_file = File.split(path)
|
||||
|
||||
if m = path.match(GLOB)
|
||||
path = path.sub(m[0], "")
|
||||
base = File.expand_path(path, File.dirname(parent_path))
|
||||
return glob_imports(base, m[2], parent_path)
|
||||
end
|
||||
|
||||
search_paths = ([parent_dir] + load_paths).uniq
|
||||
|
||||
if specified_dir != "."
|
||||
search_paths.map! do |path|
|
||||
File.join(path, specified_dir)
|
||||
end
|
||||
search_paths.select! do |path|
|
||||
File.directory?(path)
|
||||
end
|
||||
end
|
||||
|
||||
search_paths.each do |search_path|
|
||||
PREFIXS.each do |prefix|
|
||||
file_name = prefix + specified_file
|
||||
|
||||
EXTENSIONS.each do |extension|
|
||||
try_path = File.join(search_path, file_name + extension.postfix)
|
||||
if File.exist?(try_path)
|
||||
record_import_as_dependency try_path
|
||||
return extension.import_for(try_path, parent_dir, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SassC::Importer::Import.new(path)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def extension_for_file(file)
|
||||
EXTENSIONS.detect do |extension|
|
||||
file.include? extension.postfix
|
||||
end
|
||||
end
|
||||
|
||||
def record_import_as_dependency(path)
|
||||
context.depend_on path
|
||||
end
|
||||
|
||||
def context
|
||||
options[:sprockets][:context]
|
||||
end
|
||||
|
||||
def load_paths
|
||||
options[:load_paths]
|
||||
end
|
||||
|
||||
def glob_imports(base, glob, current_file)
|
||||
files = globbed_files(base, glob)
|
||||
files = files.reject { |f| f == current_file }
|
||||
|
||||
files.map do |filename|
|
||||
record_import_as_dependency(filename)
|
||||
extension = extension_for_file(filename)
|
||||
extension.import_for(filename, base, options)
|
||||
end
|
||||
end
|
||||
|
||||
def globbed_files(base, glob)
|
||||
# TODO: Raise an error from SassC here
|
||||
raise ArgumentError unless glob == "*" || glob == "**/*"
|
||||
|
||||
extensions = EXTENSIONS.map(&:postfix)
|
||||
exts = extensions.map { |ext| Regexp.escape("#{ext}") }.join("|")
|
||||
sass_re = Regexp.compile("(#{exts})$")
|
||||
|
||||
record_import_as_dependency(base)
|
||||
|
||||
files = Dir["#{base}/#{glob}"].sort.map do |path|
|
||||
if File.directory?(path)
|
||||
record_import_as_dependency(path)
|
||||
nil
|
||||
elsif sass_re =~ path
|
||||
path
|
||||
end
|
||||
end
|
||||
|
||||
files.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
81
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/railtie.rb
vendored
Normal file
81
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/railtie.rb
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'active_support/core_ext/class/attribute'
|
||||
require 'sprockets/railtie'
|
||||
|
||||
module SassC::Rails
|
||||
class Railtie < ::Rails::Railtie
|
||||
config.sass = ActiveSupport::OrderedOptions.new
|
||||
|
||||
# Establish static configuration defaults
|
||||
# Emit scss files during stylesheet generation of scaffold
|
||||
config.sass.preferred_syntax = :scss
|
||||
# Initialize the load paths to an empty array
|
||||
config.sass.load_paths = []
|
||||
|
||||
# Display line comments above each selector as a debugging aid
|
||||
config.sass.line_comments = true
|
||||
|
||||
# Set the default stylesheet engine
|
||||
# It can be overridden by passing:
|
||||
# --stylesheet_engine=sass
|
||||
# to the rails generate command
|
||||
config.app_generators.stylesheet_engine config.sass.preferred_syntax
|
||||
|
||||
if config.respond_to?(:annotations)
|
||||
config.annotations.register_extensions("scss", "sass") { |annotation| /\/\/\s*(#{annotation}):?\s*(.*)$/ }
|
||||
end
|
||||
|
||||
# Remove the sass middleware if it gets inadvertently enabled by applications.
|
||||
config.after_initialize do |app|
|
||||
app.config.middleware.delete(Sass::Plugin::Rack) if defined?(Sass::Plugin::Rack)
|
||||
end
|
||||
|
||||
initializer :setup_sass, group: :all do |app|
|
||||
# Only emit one kind of syntax because though we have registered two kinds of generators
|
||||
syntax = app.config.sass.preferred_syntax.to_sym
|
||||
alt_syntax = syntax == :sass ? "scss" : "sass"
|
||||
app.config.generators.hide_namespace alt_syntax
|
||||
|
||||
# Override stylesheet engine to the preferred syntax
|
||||
config.app_generators.stylesheet_engine syntax
|
||||
|
||||
# Establish configuration defaults that are environmental in nature
|
||||
# if config.sass.full_exception.nil?
|
||||
# # Display a stack trace in the css output when in development-like environments.
|
||||
# config.sass.full_exception = app.config.consider_all_requests_local
|
||||
# end
|
||||
|
||||
app.config.assets.configure do |env|
|
||||
env.context_class.class_eval do
|
||||
class_attribute :sass_config
|
||||
self.sass_config = app.config.sass
|
||||
end
|
||||
|
||||
if env.respond_to?(:register_transformer)
|
||||
env.register_transformer 'text/sass', 'text/css', SassC::Rails::SassTemplate.new
|
||||
env.register_transformer 'text/scss', 'text/css', SassC::Rails::ScssTemplate.new
|
||||
end
|
||||
|
||||
if env.respond_to?(:register_engine)
|
||||
[
|
||||
['.sass', SassC::Rails::SassTemplate],
|
||||
['.scss', SassC::Rails::ScssTemplate]
|
||||
].each do |engine|
|
||||
engine << { silence_deprecation: true } if Sprockets::VERSION.start_with?("3")
|
||||
env.register_engine(*engine)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initializer :setup_compression, group: :all do |app|
|
||||
if !Rails.env.development?
|
||||
app.config.assets.css_compressor = :sass unless app.config.assets.has_key?(:css_compressor)
|
||||
else
|
||||
# Use expanded output instead of the sass default of :nested unless specified
|
||||
app.config.sass.style ||= :expanded
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
113
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/template.rb
vendored
Normal file
113
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/template.rb
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "sprockets/version"
|
||||
require 'sprockets/sass_processor'
|
||||
require "sprockets/utils"
|
||||
|
||||
module SassC::Rails
|
||||
class SassTemplate < Sprockets::SassProcessor
|
||||
def initialize(options = {}, &block)
|
||||
@cache_version = options[:cache_version]
|
||||
@cache_key = "#{self.class.name}:#{VERSION}:#{SassC::VERSION}:#{@cache_version}".freeze
|
||||
#@importer_class = options[:importer] || Sass::Importers::Filesystem
|
||||
@sass_config = options[:sass_config] || {}
|
||||
@functions = Module.new do
|
||||
include Functions
|
||||
include options[:functions] if options[:functions]
|
||||
class_eval(&block) if block_given?
|
||||
end
|
||||
end
|
||||
|
||||
def call(input)
|
||||
context = input[:environment].context_class.new(input)
|
||||
|
||||
options = {
|
||||
filename: input[:filename],
|
||||
line_comments: line_comments?,
|
||||
syntax: self.class.syntax,
|
||||
load_paths: input[:environment].paths,
|
||||
importer: SassC::Rails::Importer,
|
||||
sprockets: {
|
||||
context: context,
|
||||
environment: input[:environment],
|
||||
dependencies: context.metadata[:dependency_paths]
|
||||
}
|
||||
}.merge!(config_options) { |key, left, right| safe_merge(key, left, right) }
|
||||
|
||||
engine = ::SassC::Engine.new(input[:data], options)
|
||||
|
||||
css = Sprockets::Utils.module_include(::SassC::Script::Functions, @functions) do
|
||||
engine.render
|
||||
end
|
||||
|
||||
context.metadata.merge(data: css)
|
||||
end
|
||||
|
||||
def config_options
|
||||
opts = { style: sass_style, load_paths: load_paths }
|
||||
|
||||
|
||||
if Rails.application.config.sass.inline_source_maps
|
||||
opts.merge!({
|
||||
source_map_file: ".",
|
||||
source_map_embed: true,
|
||||
source_map_contents: true,
|
||||
})
|
||||
end
|
||||
|
||||
opts
|
||||
end
|
||||
|
||||
def sass_style
|
||||
(Rails.application.config.sass.style || :expanded).to_sym
|
||||
end
|
||||
|
||||
def load_paths
|
||||
Rails.application.config.sass.load_paths || []
|
||||
end
|
||||
|
||||
def line_comments?
|
||||
Rails.application.config.sass.line_comments
|
||||
end
|
||||
|
||||
def safe_merge(_key, left, right)
|
||||
if [left, right].all? { |v| v.is_a? Hash }
|
||||
left.merge(right) { |k, l, r| safe_merge(k, l, r) }
|
||||
elsif [left, right].all? { |v| v.is_a? Array }
|
||||
(left + right).uniq
|
||||
else
|
||||
right
|
||||
end
|
||||
end
|
||||
|
||||
# The methods in the Functions module were copied here from sprockets in order to
|
||||
# override the Value class names (e.g. ::SassC::Script::Value::String)
|
||||
module Functions
|
||||
def asset_path(path, options = {})
|
||||
path = path.value
|
||||
|
||||
path, _, query, fragment = URI.split(path)[5..8]
|
||||
path = sprockets_context.asset_path(path, options)
|
||||
query = "?#{query}" if query
|
||||
fragment = "##{fragment}" if fragment
|
||||
|
||||
::SassC::Script::Value::String.new("#{path}#{query}#{fragment}", :string)
|
||||
end
|
||||
|
||||
def asset_url(path, options = {})
|
||||
::SassC::Script::Value::String.new("url(#{asset_path(path, options).value})")
|
||||
end
|
||||
|
||||
def asset_data_url(path)
|
||||
url = sprockets_context.asset_data_uri(path.value)
|
||||
::SassC::Script::Value::String.new("url(" + url + ")")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ScssTemplate < SassTemplate
|
||||
def self.syntax
|
||||
:scss
|
||||
end
|
||||
end
|
||||
end
|
7
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/version.rb
vendored
Normal file
7
debian/gems-compat/sassc-rails-2.1.2/lib/sassc/rails/version.rb
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module SassC
|
||||
module Rails
|
||||
VERSION = "2.1.2"
|
||||
end
|
||||
end
|
32
debian/gems-compat/sassc-rails-2.1.2/sassc-rails.gemspec
vendored
Normal file
32
debian/gems-compat/sassc-rails-2.1.2/sassc-rails.gemspec
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
# coding: utf-8
|
||||
lib = File.expand_path('../lib', __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'sassc/rails/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "sassc-rails"
|
||||
spec.version = SassC::Rails::VERSION
|
||||
spec.authors = ["Ryan Boland"]
|
||||
spec.email = ["ryan@tanookilabs.com"]
|
||||
spec.summary = %q{Integrate SassC-Ruby into Rails.}
|
||||
spec.description = %q{Integrate SassC-Ruby into Rails.}
|
||||
spec.homepage = "https://github.com/sass/sassc-rails"
|
||||
spec.license = "MIT"
|
||||
|
||||
spec.files = `git ls-files -z`.split("\x0")
|
||||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
||||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_development_dependency 'pry'
|
||||
spec.add_development_dependency "bundler"
|
||||
spec.add_development_dependency "rake", "~> 10.0"
|
||||
spec.add_development_dependency 'mocha'
|
||||
|
||||
spec.add_dependency "sassc", ">= 2.0"
|
||||
spec.add_dependency "tilt"
|
||||
|
||||
spec.add_dependency 'railties', '>= 4.0.0'
|
||||
spec.add_dependency 'sprockets', '> 3.0'
|
||||
spec.add_dependency 'sprockets-rails'
|
||||
end
|
11
debian/patches/0830-embed-sassc-rails.patch
vendored
Normal file
11
debian/patches/0830-embed-sassc-rails.patch
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/Gemfile
|
||||
+++ b/Gemfile
|
||||
@@ -265,7 +265,7 @@
|
||||
gem 'webpack-rails', '~> 0.9.10'
|
||||
gem 'rack-proxy', '~> 0.6.0'
|
||||
|
||||
-gem 'sassc-rails', '~> 2.1'
|
||||
+gem 'sassc-rails', '~> 2.1', path: 'vendor/gems/sassc-rails-2.1.2'
|
||||
gem 'uglifier', '~> 2.7', '>= 2.7.2'
|
||||
|
||||
gem 'addressable', '~> 2.5', '>= 2.5.2'
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
|
@ -32,3 +32,4 @@ bump-devise-to-4-6.patch
|
|||
0800-embed-omniauth0ultraauth.patch
|
||||
0810-embed-omniauth-salesforce.patch
|
||||
0820-embed-apollo-upload-server.patch
|
||||
0830-embed-sassc-rails.patch
|
||||
|
|
Loading…
Reference in a new issue