smart_assets 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8feafdbc7693ce1d631af2295f4b32fc24996fda
4
- data.tar.gz: 3a6f4c22fba94c691916545b2db23a8df70ee672
3
+ metadata.gz: 656f34484d37622c89d8f3984db7ed7393cf9a9c
4
+ data.tar.gz: 879cd2a6564f14c8e13bfb308c274aaa8c5f6380
5
5
  SHA512:
6
- metadata.gz: f086f505f8d919605399be2a504f9e644366048cd6af79c9da611df8874623c547da3c8fb00e8789f30647afdcaf6da65da1432bd6505c61513a88de6f90bc40
7
- data.tar.gz: 77a34c803172f5ac8c7f7e18473488edf2103d6b6ec560ed6e2acc1a175e40578caa016a875df2e0d43fafc0f6784c5f4fcf2e02ae47e84f8e36bfc312963c50
6
+ metadata.gz: 95e5704965557c10387f43fb330b262b0b9de18c0c863e68663b507168715c3c7eb95d0b3b0c7ed2fcb5c2a63b91236fa42a97885a94f657faf0316c5a233e28
7
+ data.tar.gz: ffcc30de0d97fb950110ee80bd755012c2b8aa7cc29a3201efe1c719cda8971ff8ec4641ae96c60ae0b0a435b6a52268e882df80f75104606ac8d1b146974af3
data/README.md CHANGED
@@ -2,21 +2,23 @@
2
2
 
3
3
  SmartAssets is a Rack Middleware for Rails that enables delivery of non-digest assets when using the default asset pipeline.
4
4
 
5
- It solves the problem of production environment requests for assets (eg: application.css) returning a 404 because they do not contain a digest (eg: application-1c8db23293725a8857e5132d59211909.css).
5
+ It solves the problem of production environment requests for assets (eg: `application.css`) returning a 404 because they do not contain a digest (eg: `application-1c8db23293725a8857e5132d59211909.css`).
6
6
 
7
7
  In general, Rails' default behavior of requiring a digest is a good idea. Serving asset files without a digest can easily result in assets being cached for long periods of time, making them impossible to update. Consider yourself warned.
8
8
 
9
9
  At the same time, there are legitimate reasons to serve assets without a digest in the name, among them using assets with 404 and other error pages and with 3rd-party applications and sites.
10
10
 
11
+ ## Usage
12
+
11
13
  This middleware works by reading the sprockets manifest file and internally changing the HTTP request to reflect the digested name. If your manifest is out of date, you will still get 404s.
12
14
 
13
- In order to minimize the risks of long caching while using this gem, requests where the requested filename is mutated will set Cache-Control: public, max-age=60.
15
+ In order to minimize the risks of long caching while using this gem, requests where the requested filename is mutated will set `Cache-Control: public,max-age=60`.
14
16
 
15
- This can configured in your environment files (or an initializer) using:
17
+ This can configured in your environment files (or an initializer). `max-age` is in seconds. If you've configured apache or nginx to set Cache-Control, you may need to ensure that configuration doesn't override this.
16
18
 
17
- config.smart_assets.cache_control = 'public, max-age=60'
19
+ config.smart_assets.cache_control = 'public,max-age=60'
18
20
 
19
- Max-age is in seconds. Caching by browsers and proxies can be disabled entirely with:
21
+ Caching by browsers and proxies can be disabled entirely with:
20
22
 
21
23
  config.smart_assets.cache_control = 'max-age=0,no-cache,no-store'
22
24
 
@@ -24,7 +26,11 @@ This middleware may also be diabled on a per-environment basis with:
24
26
 
25
27
  config.smart_assets.serve_non_digest_assets = false
26
28
 
27
- Note that `serve_static_assets` or `assets.compile` must be true or the middleware will disable itself.
29
+ It is disabled by default for `development` environments, but may be enabled there using the above setting.
30
+
31
+ `serve_static_assets` or `assets.compile` must be changed to true or the middleware will disable itself:
32
+
33
+ config.serve_static_assets = true
28
34
 
29
35
 
30
36
  ## Installation
@@ -2,9 +2,9 @@ module SmartAssets
2
2
  class Railtie < Rails::Railtie
3
3
 
4
4
  config.smart_assets = ActiveSupport::OrderedOptions.new
5
- config.smart_assets.cache_control = 'public, max-age=60'
5
+ config.smart_assets.cache_control = 'public,max-age=60'
6
6
  config.smart_assets.prefix = nil
7
- config.smart_assets.serve_non_digest_assets = true
7
+ config.smart_assets.serve_non_digest_assets = !Rails.env.development?
8
8
 
9
9
  initializer 'smart_assets.configure' do |app|
10
10
  if app.config.smart_assets.serve_non_digest_assets
@@ -1,3 +1,3 @@
1
1
  module SmartAssets
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails