active_assets 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
Active Assets
|
2
2
|
=============
|
3
3
|
|
4
|
-
A
|
4
|
+
A gem that provides an asset management system for css, javascript, and sprites in your Rails applications and engines. ActiveAssets includes two libraries, ActiveExpansions and ActiveSprites. ActiveSprites generates sprites defined by a dsl similar to a route definition. Similarly, ActiveExpansions' dsl creates `ActionView::Helpers::AssetTagHelper` javascript and stylesheet expansions, and adds additional features:
|
5
5
|
|
6
6
|
* Concatenation of included assets for expansions at boot or deploy time.
|
7
7
|
* Support for environment specific assets, so that, say, you can use one file for development and another for production or one file for development and then a cdn resource for production.
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
Installation
|
10
|
+
============
|
11
|
+
|
12
|
+
gem install active_assets -v 0.3.0
|
13
|
+
|
14
|
+
Using Bundler?
|
15
|
+
--------------
|
16
|
+
### Gemfile
|
11
17
|
|
12
18
|
...
|
13
|
-
gem 'active_assets'
|
19
|
+
gem 'active_assets', '~> 0.3.0'
|
14
20
|
...
|
15
21
|
group :development do
|
16
22
|
...
|
@@ -26,28 +32,14 @@ Gemfile
|
|
26
32
|
|
27
33
|
The above order of image libraries is also the load order precedence.
|
28
34
|
|
29
|
-
|
35
|
+
Run the generator
|
30
36
|
-----------------
|
31
|
-
### application.rb
|
32
|
-
|
33
|
-
...
|
34
|
-
require 'rails/all'
|
35
|
-
require 'active_assets/railtie'
|
36
|
-
...
|
37
|
-
|
38
|
-
#### You can also include only ActiveSprites or only ActiveExpansions in your application
|
39
|
-
### application.rb
|
40
|
-
Instead of the above,
|
41
37
|
|
42
|
-
|
43
|
-
require 'rails/all'
|
44
|
-
require 'active_assets/active_expansions/railtie'
|
45
|
-
... OR ...
|
46
|
-
require 'active_assets/active_sprites/railtie'
|
47
|
-
...
|
38
|
+
script/generate active_assets
|
48
39
|
|
49
|
-
|
50
|
-
|
40
|
+
The DSLs
|
41
|
+
========
|
42
|
+
## Introduction to Active Sprites
|
51
43
|
|
52
44
|
ActiveSprites allows you to generate sprites within your Rails apps with `rake sprites`! All you need is `rmagick`, `chunky_png`, or `mini_magick` and you are on your way. Store the images that make up your sprites within your Rails project, use the dsl below to inform ActiveSprites of which images to include in your sprites as well as the css selector corresponding to each image, the location to write the sprite, and the location to write the stylesheet.
|
53
45
|
|
@@ -97,9 +89,9 @@ Rmagick is used by default and is by far the fastest. You can use one of two me
|
|
97
89
|
...
|
98
90
|
|
99
91
|
|
100
|
-
|
92
|
+
## Introduction to Active Expansions
|
101
93
|
|
102
|
-
ActiveExpansions allow you to register Rails javascript and stylesheet expansions via a simple dsl.
|
94
|
+
ActiveExpansions allow you to register Rails javascript and stylesheet expansions via a simple dsl. Additionally, the assets in the expansion are concatenated when appropriate and the expansion delivers the concatenated (or 'cached') assets' path in the appropriate environments. Also, files can be specified as deploy only or only for a specific environment. For example, you may wish to include jQuery or Prototype src files in development and use minified libraries from cdn sources in production. This is supported.
|
103
95
|
|
104
96
|
* Below demonstration shows several variations on how to declare expansions. Note that these declaration are redundant to demonstrate how to accomplish the same thing in different ways.
|
105
97
|
* Alternatively you can also register your assets in multiple files. Simply omit `config/asets.rb` and add as many .rb files as you like inside a directory `config/assets`
|
@@ -189,16 +181,12 @@ You can specify certain assets only be used in a deployment setting or only be u
|
|
189
181
|
|
190
182
|
`_` and `a` are aliases for `asset`
|
191
183
|
|
192
|
-
#### ActiveExpansions
|
193
|
-
By default, ActiveExpansions will not cache your assets
|
184
|
+
#### ActiveExpansions caching
|
185
|
+
By default, ActiveExpansions will not cache your assets automatically. This is because if you are not serving assets from the same server as where your application resides, then you most likely want to cache your assets at deploy time (on the front-end servers). To cache assets, add the following to an initializer to concat assets at boot time or to your deploy scripts if you wish to do it when deploying:
|
194
186
|
|
195
187
|
Rails.application.expansions.javascripts.cache!
|
196
188
|
Rails.application.expansions.stylesheets.cache!
|
197
189
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
...
|
203
|
-
config.active_expansions.precache_assets = true
|
204
|
-
...
|
190
|
+
Contributing
|
191
|
+
============
|
192
|
+
You know the drill!
|
data/active_assets.gemspec
CHANGED
@@ -160,4 +160,16 @@ class ExpansionsTest < Test::Unit::TestCase
|
|
160
160
|
assert_equal %w{vendor/jquery.mousewheel.js bar/bas.js}, Rails.application.expansions.javascripts[:foo].assets.map(&:path)
|
161
161
|
end
|
162
162
|
|
163
|
+
def test_expansion_with_uri
|
164
|
+
Rails.application.expansions do
|
165
|
+
expansion :cdn, :type => :js, :namespace => :fubar do
|
166
|
+
a '//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.min.js', :cache => false, :group => :deploy
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
Rails.application.expansions.javascripts.register!
|
171
|
+
|
172
|
+
assert ActionView::Helpers::AssetTagHelper.javascript_expansions.any? {|k, v| v.include?('//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.min.js')}
|
173
|
+
end
|
174
|
+
|
163
175
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Woodard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-15 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -30,10 +30,10 @@ dependencies:
|
|
30
30
|
- 3
|
31
31
|
- 5
|
32
32
|
version: 2.3.5
|
33
|
-
type: :runtime
|
34
|
-
requirement: *id001
|
35
33
|
name: activesupport
|
36
34
|
prerelease: false
|
35
|
+
type: :runtime
|
36
|
+
requirement: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
- 3
|
47
47
|
- 5
|
48
48
|
version: 2.3.5
|
49
|
-
type: :development
|
50
|
-
requirement: *id002
|
51
49
|
name: rails
|
52
50
|
prerelease: false
|
51
|
+
type: :development
|
52
|
+
requirement: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
segments:
|
61
61
|
- 0
|
62
62
|
version: "0"
|
63
|
-
type: :development
|
64
|
-
requirement: *id003
|
65
63
|
name: rake
|
66
64
|
prerelease: false
|
65
|
+
type: :development
|
66
|
+
requirement: *id003
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
@@ -74,10 +74,10 @@ dependencies:
|
|
74
74
|
segments:
|
75
75
|
- 0
|
76
76
|
version: "0"
|
77
|
-
type: :development
|
78
|
-
requirement: *id004
|
79
77
|
name: oily_png
|
80
78
|
prerelease: false
|
79
|
+
type: :development
|
80
|
+
requirement: *id004
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
segments:
|
89
89
|
- 0
|
90
90
|
version: "0"
|
91
|
-
type: :development
|
92
|
-
requirement: *id005
|
93
91
|
name: chunky_png
|
94
92
|
prerelease: false
|
93
|
+
type: :development
|
94
|
+
requirement: *id005
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
@@ -102,10 +102,10 @@ dependencies:
|
|
102
102
|
segments:
|
103
103
|
- 0
|
104
104
|
version: "0"
|
105
|
-
type: :development
|
106
|
-
requirement: *id006
|
107
105
|
name: rmagick
|
108
106
|
prerelease: false
|
107
|
+
type: :development
|
108
|
+
requirement: *id006
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
@@ -116,10 +116,10 @@ dependencies:
|
|
116
116
|
segments:
|
117
117
|
- 0
|
118
118
|
version: "0"
|
119
|
-
type: :development
|
120
|
-
requirement: *id007
|
121
119
|
name: mini_magick
|
122
120
|
prerelease: false
|
121
|
+
type: :development
|
122
|
+
requirement: *id007
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
@@ -132,10 +132,10 @@ dependencies:
|
|
132
132
|
- 1
|
133
133
|
- 5
|
134
134
|
version: 1.1.5
|
135
|
-
type: :development
|
136
|
-
requirement: *id008
|
137
135
|
name: css_parser
|
138
136
|
prerelease: false
|
137
|
+
type: :development
|
138
|
+
requirement: *id008
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
141
141
|
none: false
|
@@ -147,10 +147,10 @@ dependencies:
|
|
147
147
|
- 2
|
148
148
|
- 0
|
149
149
|
version: "2.0"
|
150
|
-
type: :development
|
151
|
-
requirement: *id009
|
152
150
|
name: test-unit
|
153
151
|
prerelease: false
|
152
|
+
type: :development
|
153
|
+
requirement: *id009
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
version_requirements: &id010 !ruby/object:Gem::Requirement
|
156
156
|
none: false
|
@@ -163,10 +163,10 @@ dependencies:
|
|
163
163
|
- 4
|
164
164
|
- 2
|
165
165
|
version: 4.4.2
|
166
|
-
type: :development
|
167
|
-
requirement: *id010
|
168
166
|
name: ZenTest
|
169
167
|
prerelease: false
|
168
|
+
type: :development
|
169
|
+
requirement: *id010
|
170
170
|
description: A Railtie that provides an asset management system for css, javascript, and sprites in your Rails applications and engines. ActiveAssets includes two libraries, ActiveExpansions and ActiveSprites. ActiveSprites generates sprites defined by a dsl similar to a route definition. Similarly, ActiveExpansions' dsl creates ActionView::Helpers::AssetTagHelper javascript and stylesheet expansions, and adds additional features
|
171
171
|
email:
|
172
172
|
- sam@wildfireapp.com
|
@@ -391,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
391
|
requirements: []
|
392
392
|
|
393
393
|
rubyforge_project: activeassets
|
394
|
-
rubygems_version: 1.
|
394
|
+
rubygems_version: 1.6.2
|
395
395
|
signing_key:
|
396
396
|
specification_version: 3
|
397
397
|
summary: A Railtie that provides an asset management system for css, javascript, and sprites in your Rails applications and engines.
|