sass-globbing 1.0.0 → 1.1.0.pre.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.markdown +15 -0
- data/README.markdown +17 -15
- data/lib/sass/globbing/importer.rb +9 -2
- data/lib/sass/globbing/monkey_patches.rb +2 -2
- data/lib/sass/globbing/version.rb +1 -1
- data/test/fixtures/all.sass +2 -1
- data/test/sass_globbing_test.rb +2 -1
- metadata +17 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 191d169ded107c621388430015c6e73a9ec93a33
|
4
|
+
data.tar.gz: 58093b03a0eb68b661e7acca78a3a333d03ddb4a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 119d2347ac7dc0452a06580043a1479e48ced63a0bf1fdf3af31206b916b1796887e5736334ca607b1b70007b5e888bd3db8c54f90360933e382726c97794c7a
|
7
|
+
data.tar.gz: 7ef9d07c819dbf8ee302617133f3ed6fdd9a63be230cfc107fa1ccd792e8f6f88668dedb397281804aa001089d88edde361dbb592905984e97d0fc6a40f23469
|
data/CHANGELOG.markdown
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# 1.1.0
|
2
|
+
|
3
|
+
* Add the ability for a glob to not match any files. Instead a css
|
4
|
+
comment is generated that explains that nothing was found (to enable
|
5
|
+
debugging).
|
6
|
+
|
7
|
+
Because of this behavior, it is imperitive that the globbing importer
|
8
|
+
come after the compass sprite importer in the sass load path. This is
|
9
|
+
done for you automatically, but it is something to keep in mind.
|
10
|
+
|
11
|
+
* Fix a globbing issue on windows.
|
12
|
+
|
13
|
+
# 1.0.0
|
14
|
+
|
15
|
+
Initial release.
|
data/README.markdown
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Sass Globbing Plugin
|
2
2
|
|
3
|
+
Sass globbing allows you to import many sass or scss files in a single import statement.
|
4
|
+
|
5
|
+
## Stylesheet Syntax
|
6
|
+
|
7
|
+
Import a folder of files:
|
8
|
+
|
9
|
+
@import "library/mixins/*"
|
10
|
+
|
11
|
+
Import a tree of files:
|
12
|
+
|
13
|
+
@import "library/**/*"
|
14
|
+
|
15
|
+
Globbed files are sorted alphabetically before importing them.
|
16
|
+
|
17
|
+
Globs are always relative to the current file. The ruby glob file syntax is used, read the [docs][globbing_docs] for more that you can do with it.
|
18
|
+
|
3
19
|
## Installation
|
4
20
|
|
5
21
|
$ gem install sass-globbing
|
@@ -18,23 +34,9 @@ Add the following to your compass configuration:
|
|
18
34
|
|
19
35
|
Ruby on Rails has this capability out of the box starting in Rails 3.1. Do not install this plugin if you use Rails 3.1 or greater.
|
20
36
|
|
21
|
-
## Stylesheet Syntax
|
22
|
-
|
23
|
-
Import a folder of files:
|
24
|
-
|
25
|
-
@import "library/mixins/*"
|
26
|
-
|
27
|
-
Import a tree of files:
|
28
|
-
|
29
|
-
@import "library/**/*"
|
30
|
-
|
31
|
-
Globbed files are sorted alphabetically before importing them.
|
32
|
-
|
33
|
-
Globs are always relative to the current file. The ruby glob file syntax is used, read the [docs][globbing_docs] for more that you can do with it.
|
34
|
-
|
35
37
|
## Caveats
|
36
38
|
|
37
39
|
CSS is order dependent, as such, using this approach within your stylesheets to import styles that depend on the stylesheet's cascade creates an opportunity for styles to change more unpredictably than a manually asserted order. It is recommended that you only use globbing where order is unimportant; E.g. importing of library files.
|
38
40
|
|
39
41
|
|
40
|
-
[globbing_docs]: http://ruby-doc.org/core/classes/Dir.html#M000629
|
42
|
+
[globbing_docs]: http://ruby-doc.org/core/classes/Dir.html#M000629
|
@@ -27,11 +27,12 @@ class Sass::Globbing::Importer < Sass::Importers::Filesystem
|
|
27
27
|
def find_relative(name, base, options)
|
28
28
|
if name =~ GLOB
|
29
29
|
contents = ""
|
30
|
+
base = base.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
30
31
|
base_pathname = Pathname.new(base)
|
31
32
|
each_globbed_file(name, base_pathname, options) do |filename|
|
32
33
|
contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
|
33
34
|
end
|
34
|
-
|
35
|
+
contents = "/* No files to import found in #{comment_safe(name)} */" if contents.empty?
|
35
36
|
Sass::Engine.new(contents, options.merge(
|
36
37
|
:filename => base_pathname.to_s,
|
37
38
|
:importer => self,
|
@@ -76,5 +77,11 @@ class Sass::Globbing::Importer < Sass::Importers::Filesystem
|
|
76
77
|
def to_s
|
77
78
|
"Sass::Globbing::Importer"
|
78
79
|
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
|
83
|
+
def comment_safe(string)
|
84
|
+
string.gsub(%r{\*/}, "*\\/")
|
85
|
+
end
|
79
86
|
|
80
|
-
end
|
87
|
+
end
|
@@ -6,7 +6,7 @@ class Sass::Engine
|
|
6
6
|
def initialize(template, options={})
|
7
7
|
old_initialize(template, options)
|
8
8
|
unless self.options[:load_paths].include?(Sass::Globbing::Importer.instance)
|
9
|
-
self.options[:load_paths].
|
9
|
+
self.options[:load_paths].push Sass::Globbing::Importer.instance
|
10
10
|
end
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
data/test/fixtures/all.sass
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
@import "partials/*"
|
1
|
+
@import "partials/*"
|
2
|
+
@import "doesnotexist/*/foo.*"
|
data/test/sass_globbing_test.rb
CHANGED
@@ -6,7 +6,8 @@ class SassGlobbingTest < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
def test_can_import_globbed_files
|
8
8
|
css = render_file("all.sass")
|
9
|
-
assert_match
|
9
|
+
assert_match /deeply-nested/, css
|
10
|
+
assert_match %r{No files to import found in doesnotexist/\*\\/foo\.\*}, css
|
10
11
|
end
|
11
12
|
|
12
13
|
private
|
metadata
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-globbing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0.pre.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chris Eppstein
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sass
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.1'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
25
27
|
description: Allows use of globs in Sass @import directives.
|
26
28
|
email:
|
27
29
|
- chris@eppsteins.net
|
@@ -30,6 +32,7 @@ extensions: []
|
|
30
32
|
extra_rdoc_files: []
|
31
33
|
files:
|
32
34
|
- .gitignore
|
35
|
+
- CHANGELOG.markdown
|
33
36
|
- Gemfile
|
34
37
|
- README.markdown
|
35
38
|
- Rakefile
|
@@ -47,27 +50,26 @@ files:
|
|
47
50
|
- test/sass_globbing_test.rb
|
48
51
|
homepage: http://chriseppstein.github.com/
|
49
52
|
licenses: []
|
53
|
+
metadata: {}
|
50
54
|
post_install_message:
|
51
55
|
rdoc_options: []
|
52
56
|
require_paths:
|
53
57
|
- lib
|
54
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
59
|
requirements:
|
57
|
-
- -
|
60
|
+
- - '>='
|
58
61
|
- !ruby/object:Gem::Version
|
59
62
|
version: '0'
|
60
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
64
|
requirements:
|
63
|
-
- -
|
65
|
+
- - '>'
|
64
66
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
67
|
+
version: 1.3.1
|
66
68
|
requirements: []
|
67
69
|
rubyforge_project:
|
68
|
-
rubygems_version:
|
70
|
+
rubygems_version: 2.0.0.rc.2
|
69
71
|
signing_key:
|
70
|
-
specification_version:
|
72
|
+
specification_version: 4
|
71
73
|
summary: Allows use of globs in Sass @import directives.
|
72
74
|
test_files:
|
73
75
|
- test/fixtures/all.sass
|
@@ -76,3 +78,4 @@ test_files:
|
|
76
78
|
- test/fixtures/partials/nested/_nested_2.sass
|
77
79
|
- test/fixtures/partials/nested/deeply_nested/_deeply.scss
|
78
80
|
- test/sass_globbing_test.rb
|
81
|
+
has_rdoc:
|