guard-sass 0.0.6 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -2
- data/lib/guard/sass/templates/Guardfile +7 -4
- data/lib/guard/sass/version.rb +5 -0
- data/lib/guard/sass.rb +26 -18
- metadata +43 -77
data/README.md
CHANGED
@@ -22,11 +22,17 @@ And finally add a basic setup to your Guardfile with:
|
|
22
22
|
A guard extension that allows you to easily rebuild .sass (or .scss) files when changed.
|
23
23
|
|
24
24
|
guard 'sass' do
|
25
|
-
watch(
|
25
|
+
watch(%r{^sass/(.*)})
|
26
26
|
end
|
27
27
|
|
28
28
|
Defaults to writing to 'css/' but this can be changed....
|
29
29
|
|
30
30
|
guard 'sass', :output => 'styles' do
|
31
|
-
watch(
|
31
|
+
watch(%r{^sass/(.*)})
|
32
32
|
end
|
33
|
+
|
34
|
+
|
35
|
+
## Contributors
|
36
|
+
|
37
|
+
- snappycode (http://github.com/snappycode)
|
38
|
+
- sauliusg (http://github.com/sauliusg)
|
@@ -1,5 +1,8 @@
|
|
1
1
|
guard 'sass' do
|
2
|
-
watch(
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
watch(%r{^sass/.+\.s[ac]ss})
|
3
|
+
end
|
4
|
+
|
5
|
+
# # Optionally set output directory, defaults to 'css'
|
6
|
+
# guard 'sass', :output => 'public/css' do
|
7
|
+
# watch(%r{^sass/.+\.s[ac]ss})
|
8
|
+
# end
|
data/lib/guard/sass.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'guard'
|
2
2
|
require 'guard/guard'
|
3
|
+
require 'guard/watcher'
|
3
4
|
|
4
5
|
require 'sass'
|
5
6
|
|
6
7
|
module Guard
|
7
8
|
class Sass < Guard
|
8
9
|
|
9
|
-
VERSION = '0.0.6'
|
10
10
|
attr_accessor :options
|
11
11
|
|
12
12
|
def initialize(watchers = [], options = {})
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
super(watchers, {
|
14
|
+
:output => 'css',
|
15
|
+
:notifications => true,
|
16
|
+
:load_paths => Dir.glob('**/**').find_all {|i| File.directory?(i)}
|
17
|
+
}.merge(options))
|
16
18
|
end
|
17
19
|
|
18
20
|
|
@@ -50,26 +52,32 @@ module Guard
|
|
50
52
|
|
51
53
|
# Build all files being watched
|
52
54
|
def run_all
|
53
|
-
|
54
|
-
files = Dir.glob('**/*.*')
|
55
|
-
r = []
|
56
|
-
files.each do |file|
|
57
|
-
patterns.each do |pattern|
|
58
|
-
r << file if file.match(Regexp.new(pattern))
|
59
|
-
end
|
60
|
-
end
|
61
|
-
run_on_change(r)
|
55
|
+
run_on_change(Watcher.match_files(self, Dir.glob(File.join('**', '*.*'))))
|
62
56
|
end
|
63
57
|
|
64
58
|
# Build the files given
|
65
59
|
def run_on_change(paths)
|
66
|
-
paths.
|
67
|
-
|
68
|
-
|
60
|
+
changed_files = paths.reject{ |f| File.basename(f)[0] == "_" }.map do |file|
|
61
|
+
css_file = get_output(file)
|
62
|
+
begin
|
63
|
+
File.open(css_file, 'w') {|f| f.write(build_sass(file)) }
|
64
|
+
::Guard::UI.info "-> rebuilt #{file}", :reset => true
|
65
|
+
::Guard::Notifier.notify("rebuilt #{file}", :title => "Guard::Sass", :image => :success) if @options[:notifications]
|
66
|
+
css_file
|
67
|
+
rescue ::Sass::SyntaxError => e
|
68
|
+
::Guard::UI.error "Sass > #{e.sass_backtrace_str(file)}"
|
69
|
+
::Guard::Notifier.notify("rebuild failed > #{e.sass_backtrace_str(file)}", :title => "Guard::Sass", :image => :error) if @options[:notifications]
|
69
70
|
end
|
70
|
-
|
71
|
+
end.compact
|
72
|
+
notify changed_files
|
73
|
+
end
|
74
|
+
|
75
|
+
def notify(changed_files)
|
76
|
+
::Guard.guards.reject{ |guard| guard == self }.each do |guard|
|
77
|
+
paths = Watcher.match_files(guard, changed_files)
|
78
|
+
guard.run_on_change paths unless paths.empty?
|
71
79
|
end
|
72
80
|
end
|
73
81
|
|
74
82
|
end
|
75
|
-
end
|
83
|
+
end
|
metadata
CHANGED
@@ -1,130 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-sass
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
version: 0.0.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Joshua Hawxwell
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-12-14 00:00:00 +00:00
|
12
|
+
date: 2011-05-14 00:00:00.000000000 +01:00
|
18
13
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
21
16
|
name: guard
|
22
|
-
requirement: &
|
17
|
+
requirement: &2161291440 !ruby/object:Gem::Requirement
|
23
18
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
- 2
|
30
|
-
- 1
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
31
22
|
version: 0.2.1
|
32
23
|
type: :runtime
|
33
24
|
prerelease: false
|
34
|
-
version_requirements: *
|
35
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: *2161291440
|
26
|
+
- !ruby/object:Gem::Dependency
|
36
27
|
name: haml
|
37
|
-
requirement: &
|
28
|
+
requirement: &2161290980 !ruby/object:Gem::Requirement
|
38
29
|
none: false
|
39
|
-
requirements:
|
30
|
+
requirements:
|
40
31
|
- - ~>
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 3
|
44
|
-
- 0
|
45
|
-
- 0
|
32
|
+
- !ruby/object:Gem::Version
|
46
33
|
version: 3.0.0
|
47
34
|
type: :runtime
|
48
35
|
prerelease: false
|
49
|
-
version_requirements: *
|
50
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *2161290980
|
37
|
+
- !ruby/object:Gem::Dependency
|
51
38
|
name: bundler
|
52
|
-
requirement: &
|
39
|
+
requirement: &2161290520 !ruby/object:Gem::Requirement
|
53
40
|
none: false
|
54
|
-
requirements:
|
41
|
+
requirements:
|
55
42
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 1
|
59
|
-
- 0
|
60
|
-
- 2
|
43
|
+
- !ruby/object:Gem::Version
|
61
44
|
version: 1.0.2
|
62
45
|
type: :development
|
63
46
|
prerelease: false
|
64
|
-
version_requirements: *
|
65
|
-
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: *2161290520
|
48
|
+
- !ruby/object:Gem::Dependency
|
66
49
|
name: rspec
|
67
|
-
requirement: &
|
50
|
+
requirement: &2161290060 !ruby/object:Gem::Requirement
|
68
51
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 2
|
74
|
-
- 0
|
75
|
-
- 0
|
76
|
-
- rc
|
52
|
+
requirements:
|
53
|
+
- - ! '>'
|
54
|
+
- !ruby/object:Gem::Version
|
77
55
|
version: 2.0.0.rc
|
78
56
|
type: :development
|
79
57
|
prerelease: false
|
80
|
-
version_requirements: *
|
58
|
+
version_requirements: *2161290060
|
81
59
|
description: Guard::Sass automatically rebuilds sass (like sass --watch)
|
82
|
-
email:
|
60
|
+
email:
|
83
61
|
- m@hawx.me
|
84
62
|
executables: []
|
85
|
-
|
86
63
|
extensions: []
|
87
|
-
|
88
64
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
files:
|
65
|
+
files:
|
91
66
|
- lib/guard/sass/templates/Guardfile
|
67
|
+
- lib/guard/sass/version.rb
|
92
68
|
- lib/guard/sass.rb
|
93
69
|
- LICENSE
|
94
70
|
- README.md
|
95
71
|
has_rdoc: true
|
96
72
|
homepage: http://rubygems.org/gems/guard-sass
|
97
73
|
licenses: []
|
98
|
-
|
99
74
|
post_install_message:
|
100
75
|
rdoc_options: []
|
101
|
-
|
102
|
-
require_paths:
|
76
|
+
require_paths:
|
103
77
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
79
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
version: "0"
|
112
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
85
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
segments:
|
118
|
-
- 1
|
119
|
-
- 3
|
120
|
-
- 6
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
121
89
|
version: 1.3.6
|
122
90
|
requirements: []
|
123
|
-
|
124
91
|
rubyforge_project: guard-sass
|
125
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.6.2
|
126
93
|
signing_key:
|
127
94
|
specification_version: 3
|
128
95
|
summary: Guard gem for Sass
|
129
96
|
test_files: []
|
130
|
-
|