js-asset_paths 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +22 -0
- data/README.md +57 -0
- data/lib/js_asset_paths/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd6e5639e5851652bde75e58bcded56d23d7ea8c2679908cbaf086c235aa3e21
|
4
|
+
data.tar.gz: cfae798699d076b107e0dcd57bf27ec5e87cee5c7325db55a317068a078371e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 586e0965e10664cafbe9a529904770a6742437cd6140a85f6cb6d2acefef8b7107140a3b67d986a8ae78c31f67517f822fd9c60c93202274f77943b1f48de197
|
7
|
+
data.tar.gz: c9084185ea1b4bd4669f685dca454b8e476841dbd3ea45633dfc049d271a688f072afff6eae26bc322fc2f6125b503976614f4792ebfec5ff4f2315cb6905b34
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Sonny Michaud
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# JS Asset Paths
|
2
|
+
|
3
|
+
[![gem version](https://badge.fury.io/rb/js-asset_paths.svg)](https://badge.fury.io/rb/js-asset_paths)
|
4
|
+
[![build status](https://travis-ci.org/sonnym/js-asset_paths.svg?branch=master)](https://travis-ci.org/sonnym/js-asset_paths)
|
5
|
+
[![code climate](https://codeclimate.com/github/sonnym/js-asset_paths/badges/gpa.svg)](https://codeclimate.com/github/sonnym/js-asset_paths)
|
6
|
+
[![test coverage](https://codeclimate.com/github/sonnym/js-asset_paths/badges/coverage.svg)](https://codeclimate.com/github/sonnym/js-asset_paths/coverage)
|
7
|
+
|
8
|
+
Inspired by [js-routes](https://github.com/railsware/js-routes), JS Asset Paths makes the helper methods found in [ActionView::Helpers::AssetUrlHelper](http://rubydoc.info/docs/rails/ActionView/Helpers/AssetUrlHelper) available to the client.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'js-asset_paths'
|
16
|
+
```
|
17
|
+
|
18
|
+
Then require the js-asset_paths file in your `application.js`.
|
19
|
+
|
20
|
+
``` js
|
21
|
+
/*
|
22
|
+
= require js-asset_paths
|
23
|
+
*/
|
24
|
+
```
|
25
|
+
|
26
|
+
Ensure that your `config/environments/production.rb` has the following:
|
27
|
+
```ruby
|
28
|
+
config.assets.compile = true
|
29
|
+
```
|
30
|
+
(This avoids a `NoMethodError: undefined method each_file for nil:NilClass` when
|
31
|
+
precompiling your assets upon deployment.)
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
A global object called `PathHelper` will be created with the following methods:
|
36
|
+
|
37
|
+
- assetPath(source[, options])
|
38
|
+
- audioPath(source)
|
39
|
+
- fontPath(source)
|
40
|
+
- imagePath(source)
|
41
|
+
- javascriptPath(source)
|
42
|
+
- stylesheetPath(source)
|
43
|
+
- videoPath(source)
|
44
|
+
|
45
|
+
These functions operate in the same manner as their server-side counterparts.
|
46
|
+
|
47
|
+
## Explanation
|
48
|
+
|
49
|
+
JS Asset Paths inspects the configuration options for the current environment and determines whether or not a digest will be appended to the pathname of asset files. An object correlating the truncated asset path with the actual path to the asset on the server is stored in the generated javascript and referenced during each call.
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-asset_paths
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sonny Michaud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +135,8 @@ executables: []
|
|
135
135
|
extensions: []
|
136
136
|
extra_rdoc_files: []
|
137
137
|
files:
|
138
|
+
- LICENSE
|
139
|
+
- README.md
|
138
140
|
- app/assets/javascripts/js-asset_paths.js.erb
|
139
141
|
- lib/js-asset_paths.rb
|
140
142
|
- lib/js_asset_paths.rb
|
@@ -161,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
163
|
version: '0'
|
162
164
|
requirements: []
|
163
165
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.7.3
|
165
167
|
signing_key:
|
166
168
|
specification_version: 4
|
167
169
|
summary: Access paths to compiled assets from in javascript.
|