guard-sprockets 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/guard/sprockets.rb +4 -7
- data/lib/guard/sprockets/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -56,6 +56,7 @@ Please read [Guard doc](https://github.com/guard/guard#readme) for more informat
|
|
56
56
|
:minify => true # minify the JavaScript files content using Uglifier, default: false
|
57
57
|
# be sure to add: "gem 'uglifier'" in your Gemfile
|
58
58
|
:root_file => 'app/js/app.js' # if set, only this file will be compiled, default: nil
|
59
|
+
:root_file => ['one.js', 'two.js'] # root_file can be a String or an Array
|
59
60
|
```
|
60
61
|
|
61
62
|
## License
|
data/lib/guard/sprockets.rb
CHANGED
@@ -15,11 +15,11 @@ module Guard
|
|
15
15
|
@options = options
|
16
16
|
@asset_paths = Array(@options[:asset_paths] || 'app/assets/javascripts')
|
17
17
|
@destination = @options[:destination] || 'public/javascripts'
|
18
|
-
@root_file = @options[:root_file]
|
18
|
+
@root_file = Array(@options[:root_file])
|
19
19
|
|
20
20
|
@sprockets = ::Sprockets::Environment.new
|
21
21
|
@asset_paths.each { |p| @sprockets.append_path(p) }
|
22
|
-
@sprockets.append_path(
|
22
|
+
@root_file.each { |f| @sprockets.append_path(Pathname.new(f).dirname) }
|
23
23
|
|
24
24
|
if @options.delete(:minify)
|
25
25
|
begin
|
@@ -42,11 +42,11 @@ module Guard
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def run_all
|
45
|
-
|
45
|
+
run_on_changes []
|
46
46
|
end
|
47
47
|
|
48
48
|
def run_on_changes(paths)
|
49
|
-
paths =
|
49
|
+
paths = @root_file unless @root_file.empty?
|
50
50
|
|
51
51
|
success = true
|
52
52
|
paths.each do |file|
|
@@ -60,8 +60,6 @@ module Guard
|
|
60
60
|
def sprocketize(path)
|
61
61
|
path = Pathname.new(path)
|
62
62
|
|
63
|
-
@sprockets.append_path(path.dirname) unless @sprockets.paths.include?(path.dirname)
|
64
|
-
|
65
63
|
output_filename = without_preprocessor_extension(path.basename.to_s)
|
66
64
|
output_path = Pathname.new(File.join(@destination, output_filename))
|
67
65
|
|
@@ -85,6 +83,5 @@ module Guard
|
|
85
83
|
def without_preprocessor_extension(filename)
|
86
84
|
filename.gsub(/^(.*\.(?:js|css))\.[^.]+$/, '\1')
|
87
85
|
end
|
88
|
-
|
89
86
|
end
|
90
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: guard
|
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
hash:
|
105
|
+
hash: 3821057317347777043
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|