requirejs_optimizer 0.3.2 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +12 -0
- data/lib/requirejs_optimizer/railtie.rb +4 -1
- data/lib/requirejs_optimizer/step/optimize.rb +1 -1
- data/lib/requirejs_optimizer/version.rb +1 -1
- data/lib/requirejs_optimizer.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4a1a1a3e6cd182cb16095a5eb99f4217562c1d6
|
4
|
+
data.tar.gz: a976e2d233833842712c96fcd484c1179fb75ac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4231d43399c67ce921cfbc4e9fdf408ec78e066ae7148e0ae5a140433dc6213aa30311954dd10970b8a75504911f54d7876d18af227f4542781cdb52d821d62b
|
7
|
+
data.tar.gz: b95983edcf3685ebf9d690be8bda25c63deecaa99645be8ad347e76dd919fb3803eab780504c4fd181b7213fe8bc56f60e313a004dffad8d8e64edeb72644c87
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -91,6 +91,18 @@ If you have a preference, set `Rails.configuration.requirejs_optimizer_runtime`
|
|
91
91
|
|
92
92
|
If you're using rhino, you may use the configuration parameter `Rails.configuration.requirejs_optimizer_java_opts` to include java opts (like `-Xmx`) when invoking rhino.
|
93
93
|
|
94
|
+
|
95
|
+
## Overriding the base folder name (by default called "modules")
|
96
|
+
|
97
|
+
RequirejsOptimizer.base_folder = "some_other_name"
|
98
|
+
|
99
|
+
You could place the above line into an initializer file called
|
100
|
+
|
101
|
+
config/initializers/requirejs_optimizer.rb
|
102
|
+
|
103
|
+
Then "some_other_name" is used in place of "modules" in all the above paths.
|
104
|
+
|
105
|
+
|
94
106
|
## Contributing
|
95
107
|
|
96
108
|
1. Fork it
|
@@ -11,8 +11,11 @@ class RequirejsOptimizerRailtie < Rails::Railtie
|
|
11
11
|
|
12
12
|
config.before_initialize do
|
13
13
|
Rails.application.config.assets.compress = false
|
14
|
+
end
|
15
|
+
|
16
|
+
config.after_initialize do
|
14
17
|
javascripts_root_path = Rails.root.join(*%w(app/assets/javascripts/))
|
15
|
-
modules_path = javascripts_root_path.join(
|
18
|
+
modules_path = javascripts_root_path.join(RequirejsOptimizer.base_folder, '**', '*.{coffee,js}')
|
16
19
|
|
17
20
|
modules = Dir[modules_path].reject { |f| f =~ /require\.build\.js$/ }.map do |path_with_filename|
|
18
21
|
filename = path_with_filename.gsub(/^#{javascripts_root_path}\/?/, '').gsub(/\.coffee$/, '')
|
@@ -11,7 +11,7 @@ module RequirejsOptimizer
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def optimize
|
14
|
-
optimize_command = "#{runtime_cmdline} #{RequirejsOptimizer.root.join 'bin', 'r.js'} -o app/assets/javascripts/
|
14
|
+
optimize_command = "#{runtime_cmdline} #{RequirejsOptimizer.root.join 'bin', 'r.js'} -o app/assets/javascripts/#{RequirejsOptimizer.base_folder}/require.build.js"
|
15
15
|
puts optimize_command
|
16
16
|
puts "\n"
|
17
17
|
system(optimize_command)
|
data/lib/requirejs_optimizer.rb
CHANGED