frank 0.3.0.beta2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +76 -41
- data/frank.gemspec +3 -3
- data/lib/frank/base.rb +2 -2
- metadata +6 -9
data/README.md
CHANGED
@@ -4,11 +4,11 @@ Frank
|
|
4
4
|
Inspired by [Sinatra][0]'s simplicity and ease of use, Frank lets you build
|
5
5
|
static sites using your favorite libs. Frank has a built in development server
|
6
6
|
for previewing work as you develop. Frank also has a "dump" command for compiling and saving
|
7
|
-
your work out to static html
|
7
|
+
your work out to static html and css.
|
8
8
|
|
9
9
|
Frank uses [Tilt][1], so it
|
10
10
|
comes with support for [Haml & Sass][2], [LESS][10], [Builder][3], [ERB][4],
|
11
|
-
[Liquid][5], [Mustache][6]
|
11
|
+
[Liquid][5], and [Mustache][6].
|
12
12
|
|
13
13
|
Overview
|
14
14
|
--------
|
@@ -26,56 +26,84 @@ Then `cd <project_name>` and start up the server with:
|
|
26
26
|
0.0.0.0:3601
|
27
27
|
|
28
28
|
And you're ready to get to work. By default, dynamic templates are served from the `dynamic` folder,
|
29
|
-
static files are served from the `static` folder, and layouts are
|
29
|
+
static files are served from the `static` folder, and layouts are served from the `layouts` folder.
|
30
30
|
|
31
|
-
When you
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
When you're done working:
|
32
|
+
|
33
|
+
$ frankout <dump_dir>
|
34
|
+
|
35
|
+
to compile templates and copy them--along with static your assets--into `<dump_dir>`. Or,
|
35
36
|
|
36
|
-
|
37
|
+
$ frankout --production <dump_dir>
|
38
|
+
|
39
|
+
to compile & copy over, but organized to work as a static website in production. (e.g. folders named after your views, with an `index.html` inside)
|
37
40
|
|
38
41
|
Views & Meta Data
|
39
42
|
-------------------------
|
40
43
|
|
41
|
-
All of your templates,
|
42
|
-
|
43
|
-
got lots.
|
44
|
+
All of your templates, less, sass &c. go into `<project>/dynamic` by default.
|
45
|
+
You can organize them into subfolders if you've got lots.
|
44
46
|
|
45
47
|
### Views
|
46
48
|
|
47
|
-
Writing views is simple. Say you've got a `blog.haml
|
48
|
-
`http://0.0.0.0:3601/blog` and your view will be parsed and
|
49
|
+
Writing views is simple. Say you've got a `blog.haml` in `<project>/dynamic`; just browse over to
|
50
|
+
`http://0.0.0.0:3601/blog` and your view will be parsed and served up as html.
|
49
51
|
|
50
|
-
### Meta Data
|
51
52
|
|
52
|
-
|
53
|
-
This can be done with template Meta data. Meta data is set using YAML.
|
53
|
+
### Meta Data
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
Frank was designed to make controllers unnecessary. But, sometimes it's nice to have
|
56
|
+
variables in your templates / layouts. This is particularly handy if you want to set the page
|
57
|
+
title (in the layout) according to the view. This is simple, now, with meta data.
|
58
|
+
|
59
|
+
Meta fields go at the top of any view, and are written in [YAML][13]. To mark the end
|
60
|
+
of the meta section, place the meta delimeter, `META---`, on a blank line. You can
|
61
|
+
use as many hyphens as you'd like (as long as there are 3).
|
62
|
+
|
63
|
+
Meta fields are then available as local variables to all templating languages that
|
64
|
+
support them--in the view & layout:
|
65
|
+
|
66
|
+
view:
|
67
|
+
title: My Rad Page
|
68
|
+
author: My Rad Self
|
69
|
+
---------------------------------------------META
|
70
|
+
|
71
|
+
%h1= title
|
72
|
+
%h3= 'By ' + author
|
73
|
+
|
74
|
+
layout:
|
75
|
+
%title= title + '--My Rad Site'
|
76
|
+
|
58
77
|
|
59
|
-
You can access your fields as local variables in the template (if the template language supports it).
|
60
|
-
For example, you might have a template and define a field `title: My Rad Template`, then inside a haml layout,
|
61
|
-
you could create a title tag with the field: `%title= title`
|
62
78
|
|
63
79
|
Layouts (updated in 0.3)
|
64
80
|
-----------------------------
|
65
81
|
|
66
|
-
Layouts are also simple with Frank.
|
67
|
-
|
68
|
-
|
82
|
+
Layouts are also simple with Frank. Create a `default.haml` (or `.rhtml`, etc.),
|
83
|
+
in the `layouts` folder, and include a `yield` somewhere therein; views using the
|
84
|
+
layout will be inserted there.
|
69
85
|
|
70
|
-
|
86
|
+
### Namespacing Layouts
|
87
|
+
You can namespace your layouts using folders:
|
71
88
|
|
72
|
-
a
|
73
|
-
would look for
|
74
|
-
and if not found use
|
89
|
+
* When rendering a view--`dynamic_folder/blog/a-blog-post.haml`,
|
90
|
+
* Frank would first look for the layout `layouts/blog/default.haml`,
|
91
|
+
* and if not found use fall back on `layouts/default.haml`
|
75
92
|
|
76
|
-
|
77
|
-
|
78
|
-
|
93
|
+
### Multiple/No Layouts
|
94
|
+
|
95
|
+
Frank also supports choosing layouts on a view-by-view basis via meta data. Just add a
|
96
|
+
`layout` meta field:
|
97
|
+
|
98
|
+
layout: my_layout.haml
|
99
|
+
---------------------------------------------META
|
100
|
+
%h1 I'm using my_layout.haml instead of default.haml!
|
101
|
+
|
102
|
+
or if you don't want a layout at all:
|
103
|
+
|
104
|
+
layout: nil
|
105
|
+
---------------------------------------------META
|
106
|
+
%h1 No layout here!
|
79
107
|
|
80
108
|
|
81
109
|
|
@@ -85,7 +113,7 @@ Partials & Helpers
|
|
85
113
|
Frank comes with a helper method, `render_partial`, for including partials
|
86
114
|
in your views.
|
87
115
|
|
88
|
-
|
116
|
+
You can also add your own helper methods easily.
|
89
117
|
|
90
118
|
### Partials
|
91
119
|
|
@@ -107,13 +135,19 @@ to the `FrankHelpers` module; that's it. Use them just like `render_partial`.
|
|
107
135
|
Built-in Helpers
|
108
136
|
----------------
|
109
137
|
|
110
|
-
### Auto
|
138
|
+
### Auto-Refresh
|
139
|
+
|
140
|
+
Frank now has a handy automatic page refreshing helper. Just include `= refresh`
|
141
|
+
(or equivalent) in your view, and Frank will automatically refresh the page for you whenever you
|
142
|
+
save a project file. This eliminates the tedium of hundreds of manual refreshes over the course
|
143
|
+
of building a project.
|
144
|
+
|
145
|
+
When it's time to `frankout`, Frank will leave out the JavasScript bits of the refresher.
|
111
146
|
|
112
|
-
|
113
|
-
It will include a bit of javascript that refreshes the browser when you save the current template or it's layout.
|
114
|
-
You can include this in a haml template like this: `= refresh`. When you `frankout`,
|
115
|
-
the template will render an empty string instead of the script tag
|
147
|
+
### Current Page
|
116
148
|
|
149
|
+
Frank now has a `current_page` variable that you can use to set selected states on nav items.
|
150
|
+
It will return the path info from the template being processed. You also, have access to the variable from layouts and from the `frankout` command.
|
117
151
|
|
118
152
|
### Placeholder Text
|
119
153
|
|
@@ -153,7 +187,8 @@ If you would like to use the placeholder images in a context where the helper me
|
|
153
187
|
|
154
188
|
All of the lorem helpers accept an optional "replacement" argument. This will be the text rendered when you `frankout`.
|
155
189
|
For example `lorem.sentence("<%= page.content %>")` will generate a lorem sentence when you view the page using the `frankup` server.
|
156
|
-
However, when you `frankout` the template will render "<%= page.content %>".
|
190
|
+
However, when you `frankout` the template will render "<%= page.content %>". This is useful if you plan on moving a frank project
|
191
|
+
into a framework. (e.g. rails, sinatra, django, etc)
|
157
192
|
|
158
193
|
|
159
194
|
Configuration
|
@@ -179,9 +214,9 @@ Installation
|
|
179
214
|
[4]: http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/
|
180
215
|
[5]: http://www.liquidmarkup.org/
|
181
216
|
[6]: http://github.com/defunkt/mustache
|
182
|
-
[7]: http://jashkenas.github.com/coffee-script/
|
183
217
|
[8]: http://lesscss.org/
|
184
218
|
[9]: http://rack.rubyforge.org/
|
185
219
|
[10]: http://lesscss.org/
|
186
220
|
[11]: http://en.wikipedia.org/wiki/Lorem_ipsum
|
187
|
-
[12]: http://www.imagemagick.org/script/binary-releases.php?ImageMagick=4pg9cdfr8e6gn7aru9mtelepr3
|
221
|
+
[12]: http://www.imagemagick.org/script/binary-releases.php?ImageMagick=4pg9cdfr8e6gn7aru9mtelepr3
|
222
|
+
[13]: http://www.yaml.org/start.html
|
data/frank.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{frank}
|
8
|
-
s.version = "0.3.0
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["blahed", "nwah"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-21}
|
13
13
|
s.description = %q{Rapidly develop static sites using any supported templating language}
|
14
14
|
s.email = %q{travis.dunn@thisismedium.com}
|
15
15
|
s.executables = ["frank", "frankout", "frankup"]
|
data/lib/frank/base.rb
CHANGED
@@ -6,7 +6,7 @@ require 'frank/middleware/imager'
|
|
6
6
|
require 'frank/middleware/refresh'
|
7
7
|
|
8
8
|
module Frank
|
9
|
-
VERSION = '0.3.0
|
9
|
+
VERSION = '0.3.0'
|
10
10
|
|
11
11
|
module Render; end
|
12
12
|
|
@@ -98,7 +98,7 @@ module Frank
|
|
98
98
|
|
99
99
|
# regex for kinds that don't support meta
|
100
100
|
# and define the meta delimiter
|
101
|
-
nometa, delimiter = /\/_|\.(sass|less)$/, /^META-{3,}\
|
101
|
+
nometa, delimiter = /\/_|\.(sass|less)$/, /^META-{3,}\s*$|^-{3,}META\s*$/
|
102
102
|
|
103
103
|
# set the layout
|
104
104
|
layout = path.match(nometa) ? nil : layout_for(path)
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 0.3.0.beta2
|
9
|
+
version: 0.3.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- blahed
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-21 00:00:00 -04:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -183,13 +182,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
182
|
version: "0"
|
184
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
184
|
requirements:
|
186
|
-
- - "
|
185
|
+
- - ">="
|
187
186
|
- !ruby/object:Gem::Version
|
188
187
|
segments:
|
189
|
-
-
|
190
|
-
|
191
|
-
- 1
|
192
|
-
version: 1.3.1
|
188
|
+
- 0
|
189
|
+
version: "0"
|
193
190
|
requirements: []
|
194
191
|
|
195
192
|
rubyforge_project:
|