jstgenerator 0.0.1 → 0.1.0
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.
- data/README.md +25 -1
- data/bin/jstgenerator +18 -0
- data/lib/jstgenerator/version.rb +1 -1
- metadata +4 -2
data/README.md
CHANGED
@@ -17,6 +17,7 @@ And then execute:
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
+
### Within a Ruby app (such as Sinatra)
|
20
21
|
Within a Ruby app, you can do something like this:
|
21
22
|
|
22
23
|
```ruby
|
@@ -46,7 +47,22 @@ You can then load in `jst.js` and compile that template:
|
|
46
47
|
var html = window.JST["test"]({ title: "Hello World" });
|
47
48
|
```
|
48
49
|
|
49
|
-
The advantage being the compilation step (`Handlebars.compile`) is only run once.
|
50
|
+
The advantage being the compilation step (`Handlebars.compile`) is only run once and that you can keep your templates in their own file, rather than within some HTML.
|
51
|
+
|
52
|
+
###Without a Ruby app (command line)
|
53
|
+
|
54
|
+
```
|
55
|
+
$ gem install jstgenerator
|
56
|
+
$ jstgenerator [type] [glob] [output]
|
57
|
+
```
|
58
|
+
|
59
|
+
For example:
|
60
|
+
|
61
|
+
```
|
62
|
+
$ jstgenerator handlebars "views/templates/**/*.hb" lib/js/jst.js
|
63
|
+
```
|
64
|
+
|
65
|
+
Make sure you quote the glob string, else your shell may well expand it for you, which you don't want in this case.
|
50
66
|
|
51
67
|
## Contributing
|
52
68
|
|
@@ -55,3 +71,11 @@ The advantage being the compilation step (`Handlebars.compile`) is only run once
|
|
55
71
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
72
|
4. Push to the branch (`git push origin my-new-feature`)
|
57
73
|
5. Create new Pull Request
|
74
|
+
|
75
|
+
## Changelist
|
76
|
+
|
77
|
+
__0.1.0__
|
78
|
+
- added CLI tool
|
79
|
+
|
80
|
+
__0.0.1__
|
81
|
+
- initial release
|
data/bin/jstgenerator
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "jstgenerator"
|
4
|
+
type = ARGV[0]
|
5
|
+
glob = ARGV[1]
|
6
|
+
out = ARGV[2]
|
7
|
+
|
8
|
+
if type == "handlebars"
|
9
|
+
puts "Using Handlebars"
|
10
|
+
JstGenerator::Handlebars.new(:dir_glob => glob, :jst_path => out).generate
|
11
|
+
puts "Wrote JST file to #{out}"
|
12
|
+
elsif type == "underscore"
|
13
|
+
puts "Using Underscore"
|
14
|
+
JstGenerator::Underscore.new(:dir_glob => glob, :jst_path => out).generate
|
15
|
+
puts "Wrote JST file to #{out}"
|
16
|
+
else
|
17
|
+
puts "That templating library is not yet supported"
|
18
|
+
end
|
data/lib/jstgenerator/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jstgenerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -78,7 +78,8 @@ dependencies:
|
|
78
78
|
description: Compile javascript templates into a JST.js file
|
79
79
|
email:
|
80
80
|
- jack@jackfranklin.net
|
81
|
-
executables:
|
81
|
+
executables:
|
82
|
+
- jstgenerator
|
82
83
|
extensions: []
|
83
84
|
extra_rdoc_files: []
|
84
85
|
files:
|
@@ -88,6 +89,7 @@ files:
|
|
88
89
|
- LICENSE.txt
|
89
90
|
- README.md
|
90
91
|
- Rakefile
|
92
|
+
- bin/jstgenerator
|
91
93
|
- jstgenerator.gemspec
|
92
94
|
- lib/js/handlebars.js
|
93
95
|
- lib/js/underscore.js
|