assets_booster 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +57 -0
- data/lib/assets_booster/merger/css.rb +1 -1
- data/lib/assets_booster/version.rb +1 -1
- data/spec/merger/css_spec.rb +4 -2
- metadata +5 -5
- data/README +0 -0
data/README.rdoc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
=About
|
2
|
+
|
3
|
+
Assets compression (javascript and css) for rails applications. Instead of sending down a dozen javascript and css files full of formatting and comments, this gem makes it simple to merge and compress these assets down into one or more files, increasing speed and saving bandwidth.
|
4
|
+
|
5
|
+
When in development, it allows you to use your original versions and retain formatting and comments for readability and debugging.
|
6
|
+
|
7
|
+
This gem was inspired by AssetPackager from Scott Becker, but is a complete rewrite and much more powerful.
|
8
|
+
|
9
|
+
|
10
|
+
==Features
|
11
|
+
|
12
|
+
* Full rails 3 support
|
13
|
+
* Support for several compressors, easy to add your own
|
14
|
+
* Supporting url rewriting and handling of @imports in stylesheets
|
15
|
+
* Clean implementation with new codebase
|
16
|
+
* Fully spec'd and tested
|
17
|
+
|
18
|
+
|
19
|
+
==Install
|
20
|
+
|
21
|
+
Simply install it as any other gem:
|
22
|
+
|
23
|
+
gem install assets_booster
|
24
|
+
|
25
|
+
Or when using bundler, add it got your Gemfile:
|
26
|
+
|
27
|
+
gem assets_booster
|
28
|
+
|
29
|
+
|
30
|
+
==Quick Start
|
31
|
+
|
32
|
+
If you dont't have a configuration file yet, you can easily have one created using this command:
|
33
|
+
|
34
|
+
rake assets_booster:setup
|
35
|
+
|
36
|
+
To compile the assets (normally done before deployment):
|
37
|
+
|
38
|
+
rake assets_booster:compile
|
39
|
+
|
40
|
+
To get the packaged assets served simply replace your existing javascript_include_tag, stylesheet_link_tag in your views with:
|
41
|
+
|
42
|
+
assets_booster_tag(:javascript, "base")
|
43
|
+
assets_booster_tag(:stylesheet, "base", :media => "screen, projection")
|
44
|
+
|
45
|
+
|
46
|
+
==Contributing
|
47
|
+
|
48
|
+
If you'd like to contribute a feature or bugfix: Thanks! To make sure your
|
49
|
+
fix/feature has a high chance of being included, please read the following
|
50
|
+
guidelines:
|
51
|
+
|
52
|
+
1. Fork the project.
|
53
|
+
2. Make your feature addition or bug fix.
|
54
|
+
3. Add tests for it. This is important so we don’t break anything in a future version unintentionally.
|
55
|
+
4. Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
56
|
+
5. Send me a pull request. Bonus points for topic branches.
|
57
|
+
|
@@ -21,7 +21,7 @@ module AssetsBooster
|
|
21
21
|
asset = assets.pop
|
22
22
|
source_folder = dirname(asset[:source])
|
23
23
|
source_folder << "/" unless source_folder == ""
|
24
|
-
asset[:css].gsub!(/@import\s+([^;\n
|
24
|
+
asset[:css].gsub!(/@import\s+([^;\n]+)[;\n]*/).each do |import|
|
25
25
|
url = $1.gsub(/^url\((.+)\)/i, '\1')
|
26
26
|
url, quotes = extract_url(url.strip)
|
27
27
|
|
data/spec/merger/css_spec.rb
CHANGED
@@ -25,16 +25,18 @@ module AssetsBooster
|
|
25
25
|
File.stub(:read) do |source|
|
26
26
|
case source
|
27
27
|
when 'a.css'
|
28
|
-
"@import d.css"
|
28
|
+
"@import d.css;@import e.css"
|
29
29
|
when 'nested/b.css'
|
30
30
|
"@import url(http://www.example.com/test.css)"
|
31
31
|
when 'c.css'
|
32
32
|
"{color:#fff;}"
|
33
33
|
when 'd.css'
|
34
34
|
"{color:#f00;}"
|
35
|
+
when 'e.css'
|
36
|
+
"{color:#00f;}"
|
35
37
|
end
|
36
38
|
end
|
37
|
-
subject.merge("target.css").should == "{color:#f00;}\n\n@import url(http://www.example.com/test.css)\n{color:#fff;}"
|
39
|
+
subject.merge("target.css").should == "{color:#f00;}\n{color:#00f;}\n\n@import url(http://www.example.com/test.css)\n{color:#fff;}"
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assets_booster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Corin Langosch
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-21 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -78,7 +78,7 @@ files:
|
|
78
78
|
- .gitignore
|
79
79
|
- .rspec
|
80
80
|
- Gemfile
|
81
|
-
- README
|
81
|
+
- README.rdoc
|
82
82
|
- Rakefile
|
83
83
|
- asset_booster.gemspec
|
84
84
|
- lib/assets_booster.rb
|
data/README
DELETED
File without changes
|