compass-import_once 0.1.2
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 +15 -0
- data/.gitignore +5 -0
- data/CHANGELOG.markdown +3 -0
- data/Gemfile +8 -0
- data/README.markdown +21 -0
- data/Rakefile +11 -0
- data/compass-import_once.gemspec +24 -0
- data/lib/compass-import_once.rb +2 -0
- data/lib/compass/import_once/monkey_patches.rb +25 -0
- data/lib/compass/import_once/version.rb +5 -0
- data/test/compass_import_once_test.rb +25 -0
- data/test/fixtures/partials/_imported.scss +3 -0
- data/test/fixtures/test.scss +13 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmI0ZjE2MWU0NTUwY2ZjODJlMDFkN2Q4ZTlkOTY0MDNlODZiY2ViOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzNkMTc1MmEyODg5OGJmODJlM2M3MTFiNWYyNDUwYzQ0ZTEzOGViMw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDZjMGFkYWM0N2I3Mjc1MjdiYzMyMDRlM2U5NmY2N2VmOWRmMjExMjg5YWZj
|
10
|
+
YjUwZjhiZDE4MmVjZmJiODU0Y2ViNzA1ZGM2YzNmZTljZmUwZDAxYzRlN2Qx
|
11
|
+
ODI2NjIxNjlmYmE5Yjg1YWNmNmQ0NTRjOGIyYTUxNGZjZGJhOTc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjYxMzE0OGYyNGU3MzAyNzA2NzNkOTE0YWJlYTM3MTAwYTJmY2E1MmU2MDNl
|
14
|
+
ODUyNDNlZjY3ZDkyNTcyOWM4OTlkMzY3ZTUyOTk3MTMwYjY1ODIwZmY2ZThi
|
15
|
+
ZjA1ZGE1MThhMDRhZGRkMjhiZGNmZDE5OWMyYmE4MGNiN2FjMTc=
|
data/.gitignore
ADDED
data/CHANGELOG.markdown
ADDED
data/Gemfile
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Compass Import Once Plugin
|
2
|
+
|
3
|
+
This gem makes [Sass Import Once](theblacksmith/sass-import_once) work with compass.
|
4
|
+
|
5
|
+
Sass import_once changes the behaviour of the sass @import directive making never require the same file twice.
|
6
|
+
|
7
|
+
It's awesome! [Check it out](theblacksmith/sass-import_once)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
$ gem install compass-import_once
|
12
|
+
|
13
|
+
## Use with compass
|
14
|
+
|
15
|
+
Add the following to your compass configuration:
|
16
|
+
|
17
|
+
require 'compass-import_once'
|
18
|
+
|
19
|
+
## Stylesheet Syntax
|
20
|
+
|
21
|
+
The same as always :)
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path("../lib/compass/import_once/version", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "compass-import_once"
|
6
|
+
s.version = Compass::ImportOnce::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["The Blacksmith (a.k.a. Saulo Vallory)"]
|
9
|
+
s.email = ["me@saulovallory.com"]
|
10
|
+
s.homepage = "http://theblacksmithhq.com/"
|
11
|
+
s.summary = %q{Makes `sass-import_once` work with compass.}
|
12
|
+
s.description = %q{
|
13
|
+
Monkey patches compass to make `sass-import_once` work while
|
14
|
+
this issue is not solved: https://github.com/chriseppstein/compass/pull/1140
|
15
|
+
}
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency 'compass', '>= 0.12.2'
|
22
|
+
s.add_runtime_dependency 'sass-import_once', '>= 0.1.2'
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'compass'
|
2
|
+
|
3
|
+
class Compass::Compiler
|
4
|
+
alias old_initialize initialize
|
5
|
+
|
6
|
+
def initialize(working_path, from, to, options)
|
7
|
+
old_initialize(working_path, from, to, options)
|
8
|
+
self.sass_options[:importer] = Sass::ImportOnce::Importer.new(from)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module Compass::Configuration::Adapters
|
13
|
+
alias old_sass_load_paths sass_load_paths
|
14
|
+
|
15
|
+
def sass_load_paths
|
16
|
+
load_paths = old_sass_load_paths
|
17
|
+
|
18
|
+
load_paths.map! do |p|
|
19
|
+
next p if p.respond_to?(:find_relative) && !p.is_a?(Sass::Importers::Filesystem)
|
20
|
+
Sass::ImportOnce::Importer.new(p.to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
load_paths
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'sass'
|
3
|
+
require 'compass-import_once'
|
4
|
+
|
5
|
+
class SassImportOnceTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_will_import_file_once
|
8
|
+
css = render_file("test.scss")
|
9
|
+
assert_equal 1, css.scan(/#i\.was\.imported/).count
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
def render_file(filename)
|
14
|
+
fixtures_dir = File.expand_path("fixtures", File.dirname(__FILE__))
|
15
|
+
full_filename = File.expand_path(filename, fixtures_dir)
|
16
|
+
syntax = File.extname(full_filename)[1..-1].to_sym
|
17
|
+
engine = Sass::Engine.new(File.read(full_filename),
|
18
|
+
:syntax => syntax,
|
19
|
+
:filename => full_filename,
|
20
|
+
:cache => false,
|
21
|
+
:read_cache => false,
|
22
|
+
:load_paths => [fixtures_dir])
|
23
|
+
engine.render
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Let's import a file
|
2
|
+
@import "partials/imported";
|
3
|
+
|
4
|
+
// add some rules
|
5
|
+
$blue: #3bbfce;
|
6
|
+
|
7
|
+
div.bleue {
|
8
|
+
background-color: $blue;
|
9
|
+
}
|
10
|
+
|
11
|
+
// And import the same file again
|
12
|
+
// even if we change the way we reference the file, it shouldn't be imported
|
13
|
+
@import "partials/imported.scss";
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: compass-import_once
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- The Blacksmith (a.k.a. Saulo Vallory)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: compass
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.12.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.12.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sass-import_once
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.2
|
41
|
+
description: ! "\n Monkey patches compass to make `sass-import_once` work while
|
42
|
+
\n this issue is not solved: https://github.com/chriseppstein/compass/pull/1140\n
|
43
|
+
\ "
|
44
|
+
email:
|
45
|
+
- me@saulovallory.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- .gitignore
|
51
|
+
- CHANGELOG.markdown
|
52
|
+
- Gemfile
|
53
|
+
- README.markdown
|
54
|
+
- Rakefile
|
55
|
+
- compass-import_once.gemspec
|
56
|
+
- lib/compass-import_once.rb
|
57
|
+
- lib/compass/import_once/monkey_patches.rb
|
58
|
+
- lib/compass/import_once/version.rb
|
59
|
+
- test/compass_import_once_test.rb
|
60
|
+
- test/fixtures/partials/_imported.scss
|
61
|
+
- test/fixtures/test.scss
|
62
|
+
homepage: http://theblacksmithhq.com/
|
63
|
+
licenses: []
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.1.10
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Makes `sass-import_once` work with compass.
|
85
|
+
test_files:
|
86
|
+
- test/compass_import_once_test.rb
|
87
|
+
- test/fixtures/partials/_imported.scss
|
88
|
+
- test/fixtures/test.scss
|