js_assets 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/README.md +34 -0
- data/lib/js_assets/list.rb +3 -3
- data/lib/js_assets/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c73f224e905b0a4160a199d54e061f4c2fc82c5d
|
4
|
+
data.tar.gz: 43633e78c57e711694c84ad7db01284183015354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7fd358197ea9c024aee6ca80084214b4e0e29dfa9f055762fdaa04153388c115b26ca8c97d140fbdd7e392f74568f3256c3d965eaf14b1fc82a4934c15e05d
|
7
|
+
data.tar.gz: 66e776ff66a94df6a6a7b6f2a8500effe9a192a0decbb0bf4871dbf729cfd7cf4d11aad1f7cded273fa3d0d1600a9daefd506960cc83fb6375dad9ca158c519f
|
data/README.md
CHANGED
@@ -28,6 +28,34 @@ var path = asset_path('rubrics/views/index.html')
|
|
28
28
|
// /assets/rubrics/views/index-5eb3bb250d5300736006c8944e436e3f.html
|
29
29
|
```
|
30
30
|
|
31
|
+
### Slim for AngularJS
|
32
|
+
|
33
|
+
For example we want to use templating [Slim](http://rubydoc.info/gems/slim/) in [AngularJS](https://angularjs.org) app. Let our templates will be in `app/assets/webapp/`. We make the following settings:
|
34
|
+
```ruby
|
35
|
+
# config/application.rb
|
36
|
+
config.assets.paths << Rails.root.join('app', 'assets', 'webapp')
|
37
|
+
|
38
|
+
# config/initizlizers/assets_engine.rb
|
39
|
+
Rails.application.assets.register_engine('.slim', Slim::Template)
|
40
|
+
|
41
|
+
# config/environments/production.rb
|
42
|
+
config.assets.precompile += ['*.html']
|
43
|
+
```
|
44
|
+
|
45
|
+
Do not forget to connect a file in your `application.js`
|
46
|
+
```javascript
|
47
|
+
//= require app_assets
|
48
|
+
```
|
49
|
+
|
50
|
+
Now for the template `app/assets/webapp/blogs/edit.html.slim` we can get a path depending on the environment:
|
51
|
+
```javascript
|
52
|
+
var path = asset_path('blogs/edit.html')
|
53
|
+
// the function will return for development:
|
54
|
+
// /assets/blogs/edit.html
|
55
|
+
// and for production
|
56
|
+
// /assets/blogs/edit-5eb3bb250d5300736006c8944e436e3f.html
|
57
|
+
```
|
58
|
+
|
31
59
|
## Settings
|
32
60
|
|
33
61
|
You can specify, for example in the initializer, which will be available in the helper `asset_path`, and which should be excluded.
|
@@ -52,6 +80,12 @@ JsAssets::List.allow = ["*.html"]
|
|
52
80
|
|
53
81
|
Be careful! If the list of available `JsAssets::List.allow` get a file that is inserted directive `require app_assets`, recursion will occur as `sprockets` will calculate the md5-based content.
|
54
82
|
|
83
|
+
To determine which file name will be used (with md5 or not) use the option:
|
84
|
+
```ruby
|
85
|
+
# Generate digests for assets URLs.
|
86
|
+
config.assets.digest = true
|
87
|
+
```
|
88
|
+
|
55
89
|
# License #
|
56
90
|
|
57
91
|
Copyright © 2013 Zaur Abasmirzoev <<zaur.kavkaz@gmail.com>>
|
data/lib/js_assets/list.rb
CHANGED
@@ -12,10 +12,10 @@ module JsAssets
|
|
12
12
|
if logical_path = ::Rails.application.assets.send(:logical_path_for_filename, filename, assets_filters)
|
13
13
|
next if matches_filter(@exclude, logical_path, filename)
|
14
14
|
next unless matches_filter(@allow, logical_path, filename)
|
15
|
-
if ::Rails.
|
16
|
-
project_assets[logical_path] = '/assets/' + logical_path
|
17
|
-
elsif ::Rails.env.production?
|
15
|
+
if ::Rails.application.config.assets.digest
|
18
16
|
project_assets[logical_path] = '/assets/' + ::Rails.application.assets[logical_path].digest_path
|
17
|
+
else
|
18
|
+
project_assets[logical_path] = '/assets/' + logical_path
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/js_assets/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaur Abasmirzoev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04
|
11
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: yard
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Provide asset_path helper in javascript
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
49
|
- Gemfile
|
50
50
|
- MIT-LICENSE
|
51
51
|
- README.md
|
@@ -67,17 +67,17 @@ require_paths:
|
|
67
67
|
- lib
|
68
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.2.2
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Javascript helper
|