guard-sass 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/sass/runner.rb +5 -4
- data/lib/guard/sass/version.rb +1 -1
- data/lib/guard/sass.rb +16 -5
- metadata +10 -10
data/lib/guard/sass/runner.rb
CHANGED
@@ -36,10 +36,11 @@ module Guard
|
|
36
36
|
begin
|
37
37
|
css_file = write_file(compile(file), get_output_dir(file), file)
|
38
38
|
|
39
|
-
|
39
|
+
output = css_file[::Guard.listener.directory.size+1..-1]
|
40
|
+
message = options[:noop] ? "verified #{file}" : "compiled #{file} to #{output}"
|
40
41
|
@formatter.success "-> #{message}", :notification => message
|
41
42
|
|
42
|
-
changed_files <<
|
43
|
+
changed_files << output
|
43
44
|
|
44
45
|
rescue ::Sass::SyntaxError => e
|
45
46
|
message = (options[:noop] ? 'validation' : 'rebuild') + " of #{file} failed"
|
@@ -54,7 +55,7 @@ module Guard
|
|
54
55
|
# @param file [String] Path to sass/scss file to compile
|
55
56
|
# @return [String] Compiled css.
|
56
57
|
def compile(file)
|
57
|
-
content = IO.read(file)
|
58
|
+
content = IO.read(File.join(::Guard.listener.directory, file))
|
58
59
|
|
59
60
|
sass_options = {
|
60
61
|
:syntax => file[-4..-1].to_sym,
|
@@ -82,7 +83,7 @@ module Guard
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
85
|
-
folder
|
86
|
+
File.join(::Guard.listener.directory, folder)
|
86
87
|
end
|
87
88
|
|
88
89
|
# Write file contents, creating directories where required.
|
data/lib/guard/sass/version.rb
CHANGED
data/lib/guard/sass.rb
CHANGED
@@ -39,13 +39,17 @@ module Guard
|
|
39
39
|
def initialize(watchers=[], options={})
|
40
40
|
if options[:input]
|
41
41
|
options[:output] = options[:input] unless options.has_key?(:output)
|
42
|
-
watchers << ::Guard::Watcher.new(%r{^#{options.delete(:input)}/(.+\.s[ac]ss)$})
|
42
|
+
watchers << ::Guard::Watcher.new(%r{^#{ options.delete(:input) }/(.+\.s[ac]ss)$})
|
43
43
|
end
|
44
44
|
|
45
45
|
options = DEFAULTS.merge(options)
|
46
46
|
@runner = Runner.new(watchers, options)
|
47
47
|
super(watchers, options)
|
48
48
|
end
|
49
|
+
|
50
|
+
def partial?(path)
|
51
|
+
File.basename(path)[0,1] == "_"
|
52
|
+
end
|
49
53
|
|
50
54
|
# ================
|
51
55
|
# = Guard method =
|
@@ -55,7 +59,14 @@ module Guard
|
|
55
59
|
#
|
56
60
|
# @return [Boolean] No errors?
|
57
61
|
def run_all
|
58
|
-
run_on_change(
|
62
|
+
run_on_change(
|
63
|
+
Watcher.match_files(
|
64
|
+
self,
|
65
|
+
Dir.glob(File.join(::Guard.listener.directory, '**', '*.s[ac]ss')).
|
66
|
+
map {|f| f[::Guard.listener.directory.size+1..-1] }.
|
67
|
+
reject {|f| partial?(f) }
|
68
|
+
)
|
69
|
+
)
|
59
70
|
end
|
60
71
|
|
61
72
|
# Build the files given. If a 'partial' file is found (begins with '_') calls
|
@@ -63,9 +74,9 @@ module Guard
|
|
63
74
|
#
|
64
75
|
# @param paths [Array<String>]
|
65
76
|
# @return [Boolean] No errors?
|
66
|
-
def run_on_change(paths)
|
67
|
-
|
68
|
-
return run_all
|
77
|
+
def run_on_change(paths)
|
78
|
+
has_partials = paths.any? {|f| partial?(f) }
|
79
|
+
return run_all if has_partials
|
69
80
|
|
70
81
|
changed_files, success = @runner.run(paths)
|
71
82
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-12 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153122600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.4.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153122600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sass
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153122100 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153122100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153121340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153121340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153120460 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>'
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 2.0.0.rc
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153120460
|
58
58
|
description: Guard::Sass automatically rebuilds sass (like sass --watch)
|
59
59
|
email:
|
60
60
|
- m@hawx.me
|