dynamic_assets 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -8
- data/lib/dynamic_assets/config.rb +2 -6
- data/lib/dynamic_assets/controller.rb +0 -6
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -11,19 +11,21 @@ Out of the box it can (optionally):
|
|
11
11
|
* Run your CSS assets through a {Sass}[http://sass-lang.com/] pre-processor (sass or scss).
|
12
12
|
* Run them through ERB then Sass, what the heck. (Actually, this can be useful, like to allow
|
13
13
|
your app to set some Sass variables.)
|
14
|
-
* Eliminate the need for deploy-time rake tasks that combine and minify your assets.
|
15
14
|
* Combine, minify, and pre-process in memory instead of on disk, to accommodate read-only
|
16
15
|
filesystems (e.g. Heroku).
|
17
|
-
* Cache
|
16
|
+
* Set Cache-Control and Expires headers for far-future expiration,
|
18
17
|
allowing browsers and front-end caches like Varnish to hold assets for a long time.
|
19
18
|
* Allow assets to be grouped, much like
|
20
19
|
{Scott Becker's venerable asset_packager}[http://synthesis.sbecker.net/pages/asset_packager].
|
21
20
|
(Example: You may want a set of stylesheets for your main interface, and another set for your admin
|
22
21
|
interface, maybe with some overlap. With DynamicAssets, your normal users won't pay the
|
23
22
|
penalty of downloading your admin styles.)
|
24
|
-
* Allow CSS assets to refer to static images through relative URLs. That is, it doesn't break
|
23
|
+
* Allow CSS assets to refer to static images through relative URLs. That is, it doesn't break URLs
|
24
|
+
embedded in CSS.
|
25
|
+
* Invalidate caches and CDNs by inserting a timestamp into the asset URL path instead of using the
|
26
|
+
Rails scheme of appending a URL parameter. Some asset servers (notably Amazon CloudFront) will
|
27
|
+
drop parameters from the URL, so cache-busting requires path-changing.
|
25
28
|
* Honor Rails' scheme for asset hosts.
|
26
|
-
* Honor Rails' scheme for cache-busting.
|
27
29
|
|
28
30
|
It seems that Rails 3.1 will offer many of these features off-the-shelf, which is
|
29
31
|
cool. DynamicAssets allows you to get some of those features today in 3.0, but it
|
@@ -111,14 +113,14 @@ dynamically is useful enough that multiple people have thought of implementing i
|
|
111
113
|
assets.yml says to combine asset groups, stylesheet_asset_tag(:base) will
|
112
114
|
insert this one tag into your page:
|
113
115
|
|
114
|
-
<link href="/assets/stylesheets/base_v2.css
|
116
|
+
<link href="/assets/stylesheets/1302901941/base_v2.css" media="screen" rel="stylesheet" type="text/css" />
|
115
117
|
|
116
118
|
but if your assets.yml says not to combine them, stylesheet_asset_tag(:base)
|
117
119
|
will insert one tag per CSS file:
|
118
120
|
|
119
|
-
<link href="/assets/stylesheets/reset.css
|
120
|
-
<link href="/assets/stylesheets/application.css
|
121
|
-
<link href="/assets/stylesheets/sidebar.css
|
121
|
+
<link href="/assets/stylesheets/1302901941/reset.css" media="screen" rel="stylesheet" type="text/css" />
|
122
|
+
<link href="/assets/stylesheets/1302902000/application.css" media="screen" rel="stylesheet" type="text/css" />
|
123
|
+
<link href="/assets/stylesheets/1302901403/sidebar.css" media="screen" rel="stylesheet" type="text/css" />
|
122
124
|
|
123
125
|
|
124
126
|
== Variables for ERB
|
@@ -11,9 +11,7 @@ module DynamicAssets
|
|
11
11
|
end
|
12
12
|
|
13
13
|
|
14
|
-
#
|
15
|
-
# Configuration
|
16
|
-
#
|
14
|
+
# Configuration Queries
|
17
15
|
|
18
16
|
def combine_asset_groups?
|
19
17
|
@combine_asset_groups.nil? ? true : @combine_asset_groups
|
@@ -28,9 +26,7 @@ module DynamicAssets
|
|
28
26
|
end
|
29
27
|
|
30
28
|
|
31
|
-
#
|
32
|
-
# Methods
|
33
|
-
#
|
29
|
+
# Asset Queries
|
34
30
|
|
35
31
|
def asset_references_for_group_key(type, group_key)
|
36
32
|
assets_hash[type].if_present { |gs| gs[:by_group][group_key] }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamic_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robert Davis
|