handlebars_assets 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- handlebars_assets (0.1.4)
4
+ handlebars_assets (0.2.0)
5
5
  execjs (>= 1.2.9)
6
+ sprockets (>= 2.0.3)
6
7
  tilt
7
8
 
8
9
  GEM
@@ -12,9 +13,15 @@ GEM
12
13
  multi_json (~> 1.0)
13
14
  execjs (1.2.9)
14
15
  multi_json (~> 1.0)
16
+ hike (1.2.1)
15
17
  libv8 (3.3.10.2)
16
18
  multi_json (1.0.3)
19
+ rack (1.3.5)
17
20
  rake (0.9.2.2)
21
+ sprockets (2.1.2)
22
+ hike (~> 1.2)
23
+ rack (~> 1.0)
24
+ tilt (~> 1.1, != 1.3.0)
18
25
  therubyracer (0.9.8)
19
26
  libv8 (~> 3.3.10)
20
27
  tilt (1.3.3)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Use handlebars.js templates with the asset pipeline
1
+ # Use handlebars.js templates with the asset pipeline and sprockets
2
2
 
3
3
  **ALPHA**
4
4
 
@@ -6,6 +6,8 @@ Are your `handlebars.js` templates littering your Rails views with `script` tags
6
6
 
7
7
  Yea, I think so too. That is why I wrote **handlebars_assets**. Give your Handlebars templates their own files (including partials) and have them compiled, compressed, and cached as part of the Rails 3.1 asset pipeline!
8
8
 
9
+ Using `sprockets` with Sinatra or another framework? **handlebars_assets** works outside of Rails too (as of v0.2.0)
10
+
9
11
  ## Installation
10
12
 
11
13
  Load `handlebars_assets` in your `Gemfile` as part of the `assets` group
@@ -14,6 +16,8 @@ Load `handlebars_assets` in your `Gemfile` as part of the `assets` group
14
16
  gem 'handlebars_assets'
15
17
  end
16
18
 
19
+ # Compiling your Javascript templates in the Rails asset pipeline
20
+
17
21
  Require `handlebars.vm.js` in your Javascript manifest (i.e. `application.js`)
18
22
 
19
23
  //= require handlebars.vm
@@ -22,8 +26,6 @@ If you need to compile your Javascript templates in the browser as well, you sho
22
26
 
23
27
  //= require handlebars
24
28
 
25
- # Compiling your Javascript templates in the asset pipeline
26
-
27
29
  ## Precompiling
28
30
 
29
31
  `handlebars_assets` also works when you are precompiling your assets. If you are deploying to Heroku, be sure to read the [Rails guide](http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets) and in your `config/application.rb` set:
@@ -73,6 +75,8 @@ If you begin the name of the template with an underscore, it will be recognized
73
75
  todos/
74
76
  _form.hbs
75
77
 
78
+ ## TODO document Sinatra setup
79
+
76
80
  # Thanks
77
81
 
78
82
  This gem is standing on the shoulders of giants.
@@ -100,3 +104,4 @@ Once you've made your great commits
100
104
  * Matt Burke (@spraints) : execjs support
101
105
  * (@kendagriff) : 1.8.7 compatibility
102
106
  * Thorben Schröder (@walski) : 3.1 asset group for precompile
107
+ * Erwan Barrier (@erwanb) : Support for plain sprockets
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_runtime_dependency "execjs", ">= 1.2.9"
22
22
  s.add_runtime_dependency "tilt"
23
+ s.add_runtime_dependency "sprockets", ">= 2.0.3"
23
24
 
24
25
  s.add_development_dependency "activesupport", "~> 3.1.0"
25
26
  s.add_development_dependency "therubyracer"
@@ -1,7 +1,13 @@
1
1
  require "handlebars_assets/version"
2
- require 'handlebars_assets/engine'
3
2
 
4
3
  module HandlebarsAssets
5
4
  autoload(:Handlebars, 'handlebars_assets/handlebars')
6
5
  autoload(:TiltHandlebars, 'handlebars_assets/tilt_handlebars')
6
+
7
+ if defined?(Rails)
8
+ require 'handlebars_assets/engine'
9
+ else
10
+ require 'sprockets'
11
+ Sprockets.register_engine '.hbs', TiltHandlebars
12
+ end
7
13
  end
@@ -10,7 +10,7 @@ module HandlebarsAssets
10
10
  name = basename(scope.logical_path)
11
11
  compiled_hbs = Handlebars.precompile(data)
12
12
 
13
- if name.starts_with?('_')
13
+ if name.start_with?('_')
14
14
  partial_name = name[1..-1].inspect
15
15
  <<-PARTIAL
16
16
  (function() {
@@ -1,3 +1,3 @@
1
1
  module HandlebarsAssets
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebars_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-26 00:00:00.000000000Z
12
+ date: 2011-12-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
16
- requirement: &70322385407880 !ruby/object:Gem::Requirement
16
+ requirement: &70182606411080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.9
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70322385407880
24
+ version_requirements: *70182606411080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tilt
27
- requirement: &70322385407460 !ruby/object:Gem::Requirement
27
+ requirement: &70182606410440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,21 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70322385407460
35
+ version_requirements: *70182606410440
36
+ - !ruby/object:Gem::Dependency
37
+ name: sprockets
38
+ requirement: &70182606409900 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 2.0.3
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70182606409900
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: activesupport
38
- requirement: &70322385406920 !ruby/object:Gem::Requirement
49
+ requirement: &70182606409400 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: 3.1.0
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70322385406920
57
+ version_requirements: *70182606409400
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: therubyracer
49
- requirement: &70322385406500 !ruby/object:Gem::Requirement
60
+ requirement: &70182606408980 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70322385406500
68
+ version_requirements: *70182606408980
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rake
60
- requirement: &70322385406020 !ruby/object:Gem::Requirement
71
+ requirement: &70182606407240 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,7 +76,7 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70322385406020
79
+ version_requirements: *70182606407240
69
80
  description: Compile Handlebars templates in the Rails asset pipeline.
70
81
  email:
71
82
  - leshill@gmail.com