pax_global_header 0000666 0000000 0000000 00000000064 12744520544 0014521 g ustar 00root root 0000000 0000000 52 comment=26b8e2b10e9ded6f2b22346320122d685882aff3
sass-rails-5.0.6/ 0000775 0000000 0000000 00000000000 12744520544 0013612 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/.gitignore 0000664 0000000 0000000 00000000106 12744520544 0015577 0 ustar 00root root 0000000 0000000 *.gem
.bundle
*.lock
pkg/*
.sass-cache
.ruby-version
gemfiles/vendor/* sass-rails-5.0.6/.travis.yml 0000664 0000000 0000000 00000002726 12744520544 0015732 0 ustar 00root root 0000000 0000000 language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2.5
- 2.3.1
- rbx-2
gemfile:
- gemfiles/Gemfile-rails-4-0
- gemfiles/Gemfile-rails-4-1
- gemfiles/Gemfile-rails-4-2
- gemfiles/Gemfile-rails-5-0
- gemfiles/Gemfile-sprockets-2-11
- gemfiles/Gemfile-sprockets-2-12
- gemfiles/Gemfile-sprockets-2-8
- gemfiles/Gemfile-sprockets-3-0
- gemfiles/Gemfile-sprockets-4-0
- gemfiles/Gemfile-sprockets-rails-2-2
- gemfiles/Gemfile-sprockets-rails-master
- gemfiles/Gemfile-sass-3-1
- gemfiles/Gemfile-sass-3-2
- gemfiles/Gemfile-sass-3-3
- gemfiles/Gemfile-sass-3-4
sudo: false
cache: bundler
script: bundle exec rake test
matrix:
allow_failures:
- rvm: rbx-2
exclude:
- gemfile: gemfiles/Gemfile-sass-3-4
rvm: 1.9.3
- gemfile: gemfiles/Gemfile-sprockets-4-0
rvm: 1.9.3
- gemfile: gemfiles/Gemfile-rails-5-0
rvm: 1.9.3
- gemfile: gemfiles/Gemfile-rails-5-0
rvm: 2.0.0
- gemfile: gemfiles/Gemfile-rails-5-0
rvm: 2.1
include:
- gemfile: Gemfile
rvm: 2.2.5
- gemfile: Gemfile
rvm: 2.3.1
notifications:
email: false
irc:
on_success: change
on_failure: always
channels:
- "irc.freenode.org#rails-contrib"
campfire:
on_success: change
on_failure: always
rooms:
- secure: "CGWvthGkBKNnTnk9YSmf9AXKoiRI33fCl5D3jU4nx3cOPu6kv2R9nMjt9EAo\nOuS4Q85qNSf4VNQ2cUPNiNYSWQ+XiTfivKvDUw/QW9r1FejYyeWarMsSBWA+\n0fADjF1M2dkDIVLgYPfwoXEv7l+j654F1KLKB69F0F/netwP9CQ="
sass-rails-5.0.6/Gemfile 0000664 0000000 0000000 00000000244 12744520544 0015105 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem's dependencies in sass-rails.gemspec
gemspec
gem "rails", github: "rails/rails"
gem "arel", github: "rails/arel"
sass-rails-5.0.6/MIT-LICENSE 0000664 0000000 0000000 00000002051 12744520544 0015244 0 ustar 00root root 0000000 0000000 Copyright (c) 2011 Christopher Eppstein
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.
sass-rails-5.0.6/README.md 0000664 0000000 0000000 00000010343 12744520544 0015072 0 ustar 00root root 0000000 0000000 # Official Ruby-on-Rails Integration with Sass
This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language.
## Installing
Since Rails 3.1, new Rails projects will be already configured to use Sass. If you are upgrading to Rails 3.1 you will need to add the following to your Gemfile:
gem 'sass-rails'
## Configuration
To configure Sass via Rails set use `config.sass` in your
application and/or environment files to set configuration
properties that will be passed to Sass.
### Options
- `preferred_syntax` - This option determines the default Sass syntax and file extensions that will be used by Rails generators. Can be `:scss` (default CSS-compatible SCSS syntax) or `:sass` (indented Sass syntax).
The [list of supported Sass options](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#options)
can be found on the Sass Website with the following caveats:
- `:style` - This option is not supported. This is determined by the Rails environment. It's `:expanded` only on development, otherwise it's `:compressed`.
- `:never_update` - This option is not supported. Instead set `config.assets.enabled = false`
- `:always_update` - This option is not supported. Sprockets uses a controller to access stylesheets in development mode instead of a full scan for changed files.
- `:always_check` - This option is not supported. Sprockets always checks in development.
- `:syntax` - This is determined by the file's extensions.
- `:filename` - This is determined by the file's name.
- `:line` - This is provided by the template handler.
### Example
MyProject::Application.configure do
config.sass.preferred_syntax = :sass
config.sass.line_comments = false
config.sass.cache = false
end
## Important Note
Sprockets provides some directives that are placed inside of comments called `require`, `require_tree`, and
`require_self`. **DO NOT USE THEM IN YOUR SASS/SCSS FILES.** They are very
primitive and do not work well with Sass files. Instead, use Sass's native `@import` directive which
`sass-rails` has customized to integrate with the conventions of your Rails projects.
## Features
### Glob Imports
When in Rails, there is a special import syntax that allows you to
glob imports relative to the folder of the stylesheet that is doing the importing.
* `@import "mixins/*"` will import all the files in the mixins folder
* `@import "mixins/**/*"` will import all the files in the mixins tree
Any valid ruby glob may be used. The imports are sorted alphabetically.
**NOTE:** It is recommended that you only use this when importing pure library
files (containing mixins and variables) because it is difficult to control the
cascade ordering for imports that contain styles using this approach.
### Asset Helpers
When using the asset pipeline, paths to assets must be rewritten.
When referencing assets use the following asset helpers (underscored in Ruby, hyphenated
in Sass):
#### `asset-path($relative-asset-path)`
Returns a string to the asset.
* `asset-path("rails.png")` returns `"/assets/rails.png"`
#### `asset-url($relative-asset-path)`
Returns a url reference to the asset.
* `asset-url("rails.png")` returns `url(/assets/rails.png)`
As a convenience, for each of the following asset classes there are
corresponding `-path` and `-url` helpers:
image, font, video, audio, javascript, stylesheet.
* `image-path("rails.png")` returns `"/assets/rails.png"`
* `image-url("rails.png")` returns `url(/assets/rails.png)`
#### `asset-data-url($relative-asset-path)`
Returns a url reference to the Base64-encoded asset at the specified path.
* `asset-data-url("rails.png")` returns `url(data:image/png;base64,iVBORw0K...)`
## Running Tests
$ bundle install
$ bundle exec rake test
If you need to test against local gems, use Bundler's gem :path option in the Gemfile and also edit `test/support/test_helper.rb` and tell the tests where the gem is checked out.
## Code Status
* [](http://travis-ci.org/rails/sass-rails)
* [](http://badge.fury.io/rb/sass-rails)
* [](https://gemnasium.com/rails/sass-rails)
sass-rails-5.0.6/Rakefile 0000664 0000000 0000000 00000000402 12744520544 0015253 0 ustar 00root root 0000000 0000000 require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
desc 'Default: run unit tests.'
task default: :test
sass-rails-5.0.6/gemfiles/ 0000775 0000000 0000000 00000000000 12744520544 0015405 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/gemfiles/Gemfile-rails-4-0 0000664 0000000 0000000 00000000400 12744520544 0020300 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails", "~> 4.0.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-rails-4-1 0000664 0000000 0000000 00000000400 12744520544 0020301 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails", "~> 4.1.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-rails-4-2 0000664 0000000 0000000 00000000400 12744520544 0020302 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails", "~> 4.2.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-rails-5-0 0000664 0000000 0000000 00000000357 12744520544 0020314 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails", github: 'rails/rails', branch: '5-0-stable'
gem 'mime-types', '< 3', require: false if RUBY_VERSION.start_with?('1.9')
sass-rails-5.0.6/gemfiles/Gemfile-sass-3-1 0000664 0000000 0000000 00000000364 12744520544 0020150 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sass", "~> 3.1.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sass-3-2 0000664 0000000 0000000 00000000364 12744520544 0020151 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sass", "~> 3.2.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sass-3-3 0000664 0000000 0000000 00000000364 12744520544 0020152 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sass-3-4 0000664 0000000 0000000 00000000364 12744520544 0020153 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sass", "~> 3.4.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-2-11 0000664 0000000 0000000 00000000421 12744520544 0021266 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets", "~> 2.11.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-2-12 0000664 0000000 0000000 00000000421 12744520544 0021267 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets", "~> 2.12.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-2-8 0000664 0000000 0000000 00000000420 12744520544 0021213 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets", "~> 2.8.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-3-0 0000664 0000000 0000000 00000000420 12744520544 0021204 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets", "~> 3.0.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-4-0 0000664 0000000 0000000 00000000452 12744520544 0021212 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets", "~> 4.x"
gem 'mime-types', '< 3', require: false if RUBY_VERSION.start_with?('1.9')
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-rails-2-2 0000664 0000000 0000000 00000000426 12744520544 0022323 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets-rails", "~> 2.2.0"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/gemfiles/Gemfile-sprockets-rails-master 0000664 0000000 0000000 00000000453 12744520544 0023316 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
# Specify your gem"s dependencies in sass-rails.gemspec
gemspec path: ".."
gem "rails"
gem "sprockets-rails", github: "rails/sprockets-rails"
gem "sass", "~> 3.3.0"
gem "mime-types", "< 2"
gem "rack", "< 2" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.2")
sass-rails-5.0.6/lib/ 0000775 0000000 0000000 00000000000 12744520544 0014360 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/ 0000775 0000000 0000000 00000000000 12744520544 0015472 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/ 0000775 0000000 0000000 00000000000 12744520544 0017643 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/sass/ 0000775 0000000 0000000 00000000000 12744520544 0020614 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/sass/assets/ 0000775 0000000 0000000 00000000000 12744520544 0022116 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/sass/assets/assets_generator.rb 0000664 0000000 0000000 00000000531 12744520544 0026012 0 ustar 00root root 0000000 0000000 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
sass-rails-5.0.6/lib/rails/generators/sass/assets/templates/ 0000775 0000000 0000000 00000000000 12744520544 0024114 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/sass/assets/templates/stylesheet.sass 0000664 0000000 0000000 00000000257 12744520544 0027204 0 ustar 00root root 0000000 0000000 // Place all the styles related to the <%= name %> controller here.
// They will automatically be included in application.css.
// You can use Sass here: http://sass-lang.com/
sass-rails-5.0.6/lib/rails/generators/sass/scaffold/ 0000775 0000000 0000000 00000000000 12744520544 0022375 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/sass/scaffold/scaffold_generator.rb 0000664 0000000 0000000 00000000270 12744520544 0026550 0 ustar 00root root 0000000 0000000 require "rails/generators/sass_scaffold"
module Sass
module Generators
class ScaffoldGenerator < ::Sass::Generators::ScaffoldBase
def syntax() :sass end
end
end
end
sass-rails-5.0.6/lib/rails/generators/sass_scaffold.rb 0000664 0000000 0000000 00000000731 12744520544 0023003 0 ustar 00root root 0000000 0000000 require "sass/css"
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 = ::Sass::CSS.new(File.read(file)).render(syntax)
create_file "app/assets/stylesheets/scaffolds.#{syntax}", converted_contents
end
end
end
end
sass-rails-5.0.6/lib/rails/generators/scss/ 0000775 0000000 0000000 00000000000 12744520544 0020616 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/scss/assets/ 0000775 0000000 0000000 00000000000 12744520544 0022120 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/scss/assets/assets_generator.rb 0000664 0000000 0000000 00000000531 12744520544 0026014 0 ustar 00root root 0000000 0000000 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
sass-rails-5.0.6/lib/rails/generators/scss/assets/templates/ 0000775 0000000 0000000 00000000000 12744520544 0024116 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/scss/assets/templates/stylesheet.scss 0000664 0000000 0000000 00000000266 12744520544 0027210 0 ustar 00root root 0000000 0000000 // Place all the styles related to the <%= name %> controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
sass-rails-5.0.6/lib/rails/generators/scss/scaffold/ 0000775 0000000 0000000 00000000000 12744520544 0022377 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/rails/generators/scss/scaffold/scaffold_generator.rb 0000664 0000000 0000000 00000000271 12744520544 0026553 0 ustar 00root root 0000000 0000000 require "rails/generators/sass_scaffold"
module Scss
module Generators
class ScaffoldGenerator < ::Sass::Generators::ScaffoldBase
def syntax() :scss end
end
end
end
sass-rails-5.0.6/lib/sass-rails.rb 0000664 0000000 0000000 00000000025 12744520544 0016763 0 ustar 00root root 0000000 0000000 require 'sass/rails'
sass-rails-5.0.6/lib/sass/ 0000775 0000000 0000000 00000000000 12744520544 0015331 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/sass/rails.rb 0000664 0000000 0000000 00000000343 12744520544 0016770 0 ustar 00root root 0000000 0000000 module Sass
module Rails
autoload :Logger, 'sass/rails/logger'
end
end
require 'sass/rails/version'
require 'sass/rails/helpers'
require 'sass/rails/importer'
require 'sass/rails/template'
require 'sass/rails/railtie'
sass-rails-5.0.6/lib/sass/rails/ 0000775 0000000 0000000 00000000000 12744520544 0016443 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/lib/sass/rails/cache_store.rb 0000664 0000000 0000000 00000001256 12744520544 0021253 0 ustar 00root root 0000000 0000000 require 'sass'
module Sass
module Rails
class CacheStore < ::Sass::CacheStores::Base
attr_reader :environment
def initialize(environment)
@environment = environment
end
def _store(key, version, sha, contents)
environment.cache_set("sass/#{key}", {:version => version, :sha => sha, :contents => contents})
end
def _retrieve(key, version, sha)
if obj = environment.cache_get("sass/#{key}")
return unless obj[:version] == version
return unless obj[:sha] == sha
obj[:contents]
else
nil
end
end
def path_to(key)
key
end
end
end
end
sass-rails-5.0.6/lib/sass/rails/helpers.rb 0000664 0000000 0000000 00000000451 12744520544 0020432 0 ustar 00root root 0000000 0000000 require 'sass'
require 'sprockets/sass_functions'
module Sprockets
module SassFunctions
def asset_data_url(path)
Sass::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
end
end
end
::Sass::Script::Functions.send :include, Sprockets::SassFunctions
sass-rails-5.0.6/lib/sass/rails/importer.rb 0000664 0000000 0000000 00000010454 12744520544 0020635 0 ustar 00root root 0000000 0000000 require 'active_support/deprecation/reporting'
require 'sass'
require 'sprockets/sass_importer'
require 'tilt'
module Sass
module Rails
class SassImporter < Sass::Importers::Filesystem
module Globbing
GLOB = /(\A|\/)(\*|\*\*\/\*)\z/
def find_relative(name, base, options)
if options[:sprockets] && m = name.match(GLOB)
path = name.sub(m[0], "")
base = File.expand_path(path, File.dirname(base))
glob_imports(base, m[2], options)
else
super
end
end
def find(name, options)
# globs must be relative
return if name =~ GLOB
super
end
private
def glob_imports(base, glob, options)
contents = ""
context = options[:sprockets][:context]
each_globbed_file(base, glob, context) do |filename|
next if filename == options[:filename]
contents << "@import #{filename.inspect};\n"
end
return nil if contents == ""
Sass::Engine.new(contents, options.merge(
:filename => base,
:importer => self,
:syntax => :scss
))
end
def each_globbed_file(base, glob, context)
raise ArgumentError unless glob == "*" || glob == "**/*"
exts = extensions.keys.map { |ext| Regexp.escape(".#{ext}") }.join("|")
sass_re = Regexp.compile("(#{exts})$")
context.depend_on(base)
Dir["#{base}/#{glob}"].sort.each do |path|
if File.directory?(path)
context.depend_on(path)
elsif sass_re =~ path
yield path
end
end
end
end
module ERB
def extensions
{
'css.erb' => :scss_erb,
'scss.erb' => :scss_erb,
'sass.erb' => :sass_erb
}.merge(super)
end
def erb_extensions
{
:scss_erb => :scss,
:sass_erb => :sass
}
end
def find_relative(*args)
process_erb_engine(super)
end
def find(*args)
process_erb_engine(super)
end
private
def process_erb_engine(engine)
if engine && engine.options[:sprockets] && syntax = erb_extensions[engine.options[:syntax]]
template = Tilt::ERBTemplate.new(engine.options[:filename])
contents = template.render(engine.options[:sprockets][:context], {})
Sass::Engine.new(contents, engine.options.merge(:syntax => syntax))
else
engine
end
end
end
module Deprecated
def extensions
{
'css.scss' => :scss,
'css.sass' => :sass,
'css.scss.erb' => :scss_erb,
'css.sass.erb' => :sass_erb
}.merge(super)
end
def find_relative(*args)
deprecate_extra_css_extension(super)
end
def find(*args)
deprecate_extra_css_extension(super)
end
private
def deprecate_extra_css_extension(engine)
if engine && filename = engine.options[:filename]
if filename.end_with?('.css.scss')
msg = "Extra .css in SCSS file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss', '.scss')}."
elsif filename.end_with?('.css.sass')
msg = "Extra .css in SASS file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass', '.sass')}."
elsif filename.end_with?('.css.scss.erb')
msg = "Extra .css in SCSS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.scss.erb', '.scss.erb')}."
elsif filename.end_with?('.css.sass.erb')
msg = "Extra .css in SASS/ERB file is unnecessary. Rename #{filename} to #{filename.sub('.css.sass.erb', '.sass.erb')}."
end
ActiveSupport::Deprecation.warn(msg) if msg
end
engine
end
end
include Deprecated
include ERB
include Globbing
# Allow .css files to be @import'd
def extensions
{ 'css' => :scss }.merge(super)
end
end
end
end
sass-rails-5.0.6/lib/sass/rails/logger.rb 0000664 0000000 0000000 00000000702 12744520544 0020246 0 ustar 00root root 0000000 0000000 require 'sass'
require 'sass/logger'
module Sass
module Rails
class Logger < Sass::Logger::Base
def _log(level, message)
case level
when :trace, :debug
::Rails.logger.debug message
when :warn
::Rails.logger.warn message
when :error
::Rails.logger.error message
when :info
::Rails.logger.info message
end
end
end
end
end
sass-rails-5.0.6/lib/sass/rails/railtie.rb 0000664 0000000 0000000 00000007301 12744520544 0020422 0 ustar 00root root 0000000 0000000 require 'sass'
require 'active_support/core_ext/class/attribute'
require 'sprockets/railtie'
module Sass::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
# Write sass cache files for performance
config.sass.cache = true
# Read sass cache files for performance
config.sass.read_cache = true
# Display line comments above each selector as a debugging aid
config.sass.line_comments = true
# Initialize the load paths to an empty array
config.sass.load_paths = []
# Send Sass logs to Rails.logger
config.sass.logger = Sass::Rails::Logger.new
# 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
# Set the sass cache location
config.sass.cache_location = File.join(Rails.root, "tmp/cache/sass")
# Establish configuration defaults that are evironmental 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
config.assets.configure do |env|
if env.respond_to?(:register_engine)
args = ['.sass', Sass::Rails::SassTemplate]
args << { silence_deprecation: true } if env.method(:register_engine).arity.abs > 2
env.register_engine(*args)
args = ['.scss', Sass::Rails::ScssTemplate]
args << { silence_deprecation: true } if env.method(:register_engine).arity.abs > 2
env.register_engine(*args)
end
if env.respond_to?(:register_transformer)
env.register_transformer 'text/sass', 'text/css',
Sprockets::SassProcessor.new(importer: SassImporter, sass_config: app.config.sass)
env.register_transformer 'text/scss', 'text/css',
Sprockets::ScssProcessor.new(importer: SassImporter, sass_config: app.config.sass)
end
env.context_class.class_eval do
class_attribute :sass_config
self.sass_config = app.config.sass
end
end
Sass.logger = app.config.sass.logger
end
initializer :setup_compression, group: :all do |app|
if Rails.env.development?
# Use expanded output instead of the sass default of :nested unless specified
app.config.sass.style ||= :expanded
else
# config.assets.css_compressor may be set to nil in non-dev environments.
# otherwise, the default is sass compression.
app.config.assets.css_compressor = :sass unless app.config.assets.has_key?(:css_compressor)
end
end
end
end
sass-rails-5.0.6/lib/sass/rails/template.rb 0000664 0000000 0000000 00000003007 12744520544 0020603 0 ustar 00root root 0000000 0000000 require 'sass'
require 'sass/rails/cache_store'
require 'sass/rails/helpers'
require 'sprockets/sass_functions'
require 'tilt'
module Sass
module Rails
class SassTemplate < Tilt::Template
def self.default_mime_type
'text/css'
end
def self.engine_initialized?
true
end
def initialize_engine
end
def prepare
end
def syntax
:sass
end
def evaluate(context, locals, &block)
cache_store = CacheStore.new(context.environment)
options = {
:filename => eval_file,
:line => line,
:syntax => syntax,
:cache_store => cache_store,
:importer => importer_class.new(context.pathname.to_s),
:load_paths => context.environment.paths.map { |path| importer_class.new(path.to_s) },
:sprockets => {
:context => context,
:environment => context.environment
}
}
sass_config = context.sass_config.merge(options)
engine = ::Sass::Engine.new(data, sass_config)
css = engine.render
engine.dependencies.map do |dependency|
context.depend_on(dependency.options[:filename])
end
css
rescue ::Sass::SyntaxError => e
context.__LINE__ = e.sass_backtrace.first[:line]
raise e
end
private
def importer_class
SassImporter
end
end
class ScssTemplate < SassTemplate
def syntax
:scss
end
end
end
end
sass-rails-5.0.6/lib/sass/rails/version.rb 0000664 0000000 0000000 00000000073 12744520544 0020455 0 ustar 00root root 0000000 0000000 module Sass
module Rails
VERSION = "5.0.6"
end
end
sass-rails-5.0.6/sass-rails.gemspec 0000664 0000000 0000000 00000001710 12744520544 0017237 0 ustar 00root root 0000000 0000000 # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "sass/rails/version"
Gem::Specification.new do |s|
s.name = "sass-rails"
s.version = Sass::Rails::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["wycats", "chriseppstein"]
s.email = ["wycats@gmail.com", "chris@eppsteins.net"]
s.homepage = "https://github.com/rails/sass-rails"
s.summary = %q{Sass adapter for the Rails asset pipeline.}
s.description = %q{Sass adapter for the Rails asset pipeline.}
s.license = %q{MIT}
s.add_dependency 'railties', '>= 4.0.0', '< 6'
s.add_dependency 'sass', '~> 3.1'
s.add_dependency 'sprockets-rails', '>= 2.0', '< 4.0'
s.add_dependency 'sprockets', '>= 2.8', '< 4.0'
s.add_dependency 'tilt', '>= 1.1', '< 3'
s.add_development_dependency 'sqlite3'
s.files = Dir["MIT-LICENSE", "README.md", "lib/**/*"]
s.require_paths = ["lib"]
end
sass-rails-5.0.6/test/ 0000775 0000000 0000000 00000000000 12744520544 0014571 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/ 0000775 0000000 0000000 00000000000 12744520544 0016442 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/alternate_config_project/ 0000775 0000000 0000000 00000000000 12744520544 0023474 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/alternate_config_project/.gitignore 0000664 0000000 0000000 00000000061 12744520544 0025461 0 ustar 00root root 0000000 0000000 .bundle
db/*.sqlite3
log/*.log
tmp/
.sass-cache/
sass-rails-5.0.6/test/fixtures/alternate_config_project/Gemfile 0000664 0000000 0000000 00000000257 12744520544 0024773 0 ustar 00root root 0000000 0000000 source 'https://rubygems.org'
gem 'rails', '>= 4.0.0.beta', '< 5.0'
gem 'sqlite3'
# Asset template engines
gem 'sass-rails', path: File.expand_path('../../../..', __FILE__)
sass-rails-5.0.6/test/fixtures/alternate_config_project/README 0000664 0000000 0000000 00000021770 12744520544 0024363 0 ustar 00root root 0000000 0000000 == Welcome to Rails
Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern.
This pattern splits the view (also called the presentation) into "dumb"
templates that are primarily responsible for inserting pre-built data in between
HTML tags. The model contains the "smart" domain objects (such as Account,
Product, Person, Post) that holds all the business logic and knows how to
persist themselves to a database. The controller handles the incoming requests
(such as Save New Account, Update Product, Show Post) by manipulating the model
and directing data to the view.
In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic
methods. You can read more about Active Record in
link:files/vendor/rails/activerecord/README.html.
The controller and view are handled by the Action Pack, which handles both
layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of
Rails. You can read more about Action Pack in
link:files/vendor/rails/actionpack/README.html.
== Getting Started
1. At the command prompt, create a new Rails application:
rails new myapp (where myapp is the application name)
2. Change directory to myapp and start the web server:
cd myapp; rails server (run with --help for options)
3. Go to http://localhost:3000/ and you'll see:
"Welcome aboard: You're riding Ruby on Rails!"
4. Follow the guidelines to start developing your application. You can find
the following resources handy:
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
== Debugging Rails
Sometimes your application goes wrong. Fortunately there are a lot of tools that
will help you debug it and get it back on the rails.
First area to check is the application log files. Have "tail -f" commands
running on the server.log and development.log. Rails will automatically display
debugging and runtime information to these files. Debugging info will also be
shown in the browser on requests from 127.0.0.1.
You can also log your own messages directly into the log file from your code
using the Ruby logger class from inside your controllers. Example:
class WeblogController < ActionController::Base
def destroy
@weblog = Weblog.find(params[:id])
@weblog.destroy
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
end
end
The result will be a message in your log file along the lines of:
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
More information on how to use the logger is at http://www.ruby-doc.org/core/
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
several books available online as well:
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
These two books will bring you up to speed on the Ruby language and also on
programming in general.
== Debugger
Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
resume execution! You need to install ruby-debug to run the server in debugging
mode. With gems, use sudo gem install ruby-debug. Example:
class WeblogController < ActionController::Base
def index
@posts = Post.all
debugger
end
end
So the controller will accept the action, run the first line, then present you
with a IRB prompt in the server window. Here you can do things like:
>> @posts.inspect
=> "[#nil, "body"=>nil, "id"=>"1"}>,
#"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
>> @posts.first.title = "hello from a debugger"
=> "hello from a debugger"
...and even better, you can examine how your runtime objects actually work:
>> f = @posts.first
=> #nil, "body"=>nil, "id"=>"1"}>
>> f.
Display all 152 possibilities? (y or n)
Finally, when you're ready to resume execution, you can enter "cont".
== Console
The console is a Ruby shell, which allows you to interact with your
application's domain model. Here you'll have all parts of the application
configured, just like it is when the application is running. You can inspect
domain models, change values, and save to the database. Starting the script
without arguments will launch it in the development environment.
To start the console, run rails console from the application
directory.
Options:
* Passing the -s, --sandbox argument will rollback any modifications
made to the database.
* Passing an environment name as an argument will load the corresponding
environment. Example: rails console production.
To reload your controllers and models after launching the console run
reload!
More information about irb can be found at:
link:http://www.rubycentral.org/pickaxe/irb.html
== dbconsole
You can go to the command line of your database directly through rails
dbconsole. You would be connected to the database with the credentials
defined in database.yml. Starting the script without arguments will connect you
to the development database. Passing an argument will connect you to a different
database, like rails dbconsole production. Currently works for MySQL,
PostgreSQL and SQLite 3.
== Description of Contents
The default directory structure of a generated Ruby on Rails application:
|-- app
| |-- assets
| |-- images
| |-- javascripts
| `-- stylesheets
| |-- controllers
| |-- helpers
| |-- mailers
| |-- models
| `-- views
| `-- layouts
|-- config
| |-- environments
| |-- initializers
| `-- locales
|-- db
|-- doc
|-- lib
| `-- tasks
|-- log
|-- public
|-- script
|-- test
| |-- fixtures
| |-- functional
| |-- integration
| |-- performance
| `-- unit
|-- tmp
| |-- cache
| |-- pids
| |-- sessions
| `-- sockets
`-- vendor
|-- assets
`-- stylesheets
`-- plugins
app
Holds all the code that's specific to this particular application.
app/assets
Contains subdirectories for images, stylesheets, and JavaScript files.
app/controllers
Holds controllers that should be named like weblogs_controller.rb for
automated URL mapping. All controllers should descend from
ApplicationController which itself descends from ActionController::Base.
app/models
Holds models that should be named like post.rb. Models descend from
ActiveRecord::Base by default.
app/views
Holds the template files for the view that should be named like
weblogs/index.html.erb for the WeblogsController#index action. All views use
eRuby syntax by default.
app/views/layouts
Holds the template files for layouts to be used with views. This models the
common header/footer method of wrapping views. In your views, define a layout
using the layout :default and create a file named default.html.erb.
Inside default.html.erb, call <% yield %> to render the view using this
layout.
app/helpers
Holds view helpers that should be named like weblogs_helper.rb. These are
generated for you automatically when using generators for controllers.
Helpers can be used to wrap functionality for your views into methods.
config
Configuration files for the Rails environment, the routing map, the database,
and other dependencies.
db
Contains the database schema in schema.rb. db/migrate contains all the
sequence of Migrations for your schema.
doc
This directory is where your application documentation will be stored when
generated using rake doc:app
lib
Application specific libraries. Basically, any kind of custom code that
doesn't belong under controllers, models, or helpers. This directory is in
the load path.
public
The directory available for the web server. Also contains the dispatchers and the
default HTML files. This should be set as the DOCUMENT_ROOT of your web
server.
script
Helper scripts for automation and generation.
test
Unit and functional tests along with fixtures. When using the rails generate
command, template test files will be generated for you and placed in this
directory.
vendor
External libraries that the application depends on. Also includes the plugins
subdirectory. If the app has frozen rails, those gems also go here, under
vendor/rails/. This directory is in the load path.
sass-rails-5.0.6/test/fixtures/alternate_config_project/Rakefile 0000664 0000000 0000000 00000000437 12744520544 0025145 0 ustar 00root root 0000000 0000000 #!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
AlternateConfigProject::Application.load_tasks
sass-rails-5.0.6/test/fixtures/alternate_config_project/app/ 0000775 0000000 0000000 00000000000 12744520544 0024254 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/alternate_config_project/app/assets/ 0000775 0000000 0000000 00000000000 12744520544 0025556 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/alternate_config_project/app/assets/config/ 0000775 0000000 0000000 00000000000 12744520544 0027023 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/alternate_config_project/app/assets/config/manifest.js 0000664 0000000 0000000 00000000144 12744520544 0031166 0 ustar 00root root 0000000 0000000 //= link_tree ./images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
sass-rails-5.0.6/test/fixtures/alternate_config_project/app/assets/images/ 0000775 0000000 0000000 00000000000 12744520544 0027023 5 ustar 00root root 0000000 0000000 sass-rails-5.0.6/test/fixtures/alternate_config_project/app/assets/images/1x1.png 0000664 0000000 0000000 00000001636 12744520544 0030150 0 ustar 00root root 0000000 0000000 ‰PNG
IHDR ĉ tEXtSoftware Adobe ImageReadyqÉe<