webshims-rails 1.15.6.3 → 1.15.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +1 -0
- data/README.md +23 -2
- data/lib/tasks/webshims.rake +16 -0
- data/lib/webshims-rails/version.rb +1 -1
- 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: de20e91955be5fa9ad61b77fc4960f994a343c99
|
4
|
+
data.tar.gz: ed5b1591977fa5a2eafd512790dfc29700c78f0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140ba62bf2a05af0b1c4c7d7180b41695b52bd79c2236ba28e707999786c3aade9dd804b8beabcee2c432eb9497e4ccc64a07e9a8f5ffe012f16b5cb8a2080e3
|
7
|
+
data.tar.gz: 2b21cd9cb69b86289d737bfc8e47853f1de2b21713a440d50fc55cb439d1546257d4a68c4037daa2d4aaab279cf9fd7fb426c8d2fbcd72822955e6eb456c484e
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
2015-04-20
|
2
2
|
-------------------
|
3
3
|
* Added minified version of webshims library to lib/assets; updated the rake task `rake webshims:update_public` to copy the minified versions over to /public, since these files are not precompiled.
|
4
|
+
* Added update_public_versioned to copy webshims assets to version-namespaced directory, preventing upstream caching issues
|
4
5
|
|
5
6
|
2015-01-19
|
6
7
|
-------------------
|
data/README.md
CHANGED
@@ -6,9 +6,30 @@ Easily include the [webshims library](http://aFarkas.github.com/webshim/demos/in
|
|
6
6
|
|
7
7
|
With the release of Rails 4 and an updated [sprockets-rails](https://github.com/rails/sprockets-rails#changes-from-rails-3x gem), only digest filenames are compiled when running rake assets:precompile (non-digest filenames are no longer compiled).
|
8
8
|
|
9
|
-
Since webshims does not support fingerprinting, this will result in 404s (missing assets) in production mode, since webshims dynamically chooses shim javascript files to request depending on the browser. To avoid this, you have
|
9
|
+
Since webshims does not support fingerprinting, this will result in 404s (missing assets) in production mode, since webshims dynamically chooses shim javascript files to request depending on the browser. To avoid this, you have three options:
|
10
10
|
|
11
|
-
|
11
|
+
1a. **Recommended**: Versioned-copy to /public. Run this rake task every time you update webshims:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
rake webshims:update_public_versioned
|
15
|
+
```
|
16
|
+
|
17
|
+
This copies the webshims files (minified versions) into your Rails public/ directory, at `public/webshims/[webshims.verison]`. Scoping the webshims files to the webshims path will prevent browsers from caching old webshims code.
|
18
|
+
|
19
|
+
Then, alter step 3 below to re-configure your basePath from public/assets (as it was in Rails 3.X) to public/:
|
20
|
+
|
21
|
+
```javascript
|
22
|
+
$.webshims.setOptions('basePath', '/webshims/[webshims-version]/shims/')
|
23
|
+
```
|
24
|
+
|
25
|
+
You can add an .erb extention to your javascript file and have it set the webshims version path.
|
26
|
+
|
27
|
+
```javascript
|
28
|
+
$.webshims.setOptions('basePath', '/webshims/<%= Webshims::Rails::WEBSHIMS_VERSION %>/shims/')
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
1B. [This is the older, simpler version of 1a.] Copy webshims to the /public directory. Run this rake task every time you update webshims:
|
12
33
|
|
13
34
|
```bash
|
14
35
|
rake webshims:update_public
|
data/lib/tasks/webshims.rake
CHANGED
@@ -4,4 +4,20 @@ desc "Copy the webshims to public/webshims so dynamic features will work."
|
|
4
4
|
task "webshims:update_public" do
|
5
5
|
shim_root = Webshims::Rails::Engine.root.join('lib', 'assets', 'javascripts', 'webshims')
|
6
6
|
FileUtils.cp_r(shim_root, Rails.root.join('public'))
|
7
|
+
|
8
|
+
puts "Updated webshims files in /public/webshims"
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
desc "Copy the webshims to public/webshims/[version] for cache-busting."
|
13
|
+
task "webshims:update_public_versioned" do
|
14
|
+
shim_root = Webshims::Rails::Engine.root.join('lib', 'assets', 'javascripts', 'webshims')
|
15
|
+
FileUtils.rm_rf(Rails.root.join('public', 'webshims'))
|
16
|
+
FileUtils.mkdir(Rails.root.join('public', 'webshims'))
|
17
|
+
FileUtils.cp_r(shim_root, Rails.root.join('public', 'webshims', Webshims::Rails::WEBSHIMS_VERSION))
|
18
|
+
|
19
|
+
puts "Updated webshims files in /public/webshims/#{Webshims::Rails::WEBSHIMS_VERSION}/"
|
20
|
+
puts "\nBe sure your webshims options are set as follows:"
|
21
|
+
puts %Q{ $.webshims.setOptions('basePath', '/webshims/#{Webshims::Rails::WEBSHIMS_VERSION}/shims/')}
|
22
|
+
puts "\nYou can use ERB to dynamically set this path; See README for more information."
|
7
23
|
end
|