cerrado @ 60e8e751c76d949a28eefe0c5462e0cf17337217

feat: Add slug to build
  1diff --git a/Makefile b/Makefile
  2index 61df8351f7c79059ecf9ef2db0351c527b37e023..53b076749dac0fd0399fed31a3857ea3c338db01 100644
  3--- a/Makefile
  4+++ b/Makefile
  5@@ -1,5 +1,10 @@
  6-build: sass tmpl
  7-	go build -o bin/cerrado
  8+COMMIT := $(shell git rev-parse --short HEAD)
  9+LDFLAGS := "-X 'git.gabrielgio.me/cerrado/templates.Slug=.$(COMMIT)' -s -w"
 10+
 11+build: sass-slug tmpl
 12+	go build \
 13+		-ldflags=$(LDFLAGS) \
 14+		-o bin/cerrado
 15 
 16 run: sass tmpl
 17 	go run .
 18@@ -7,8 +12,13 @@
 19 test:
 20 	go test -v --tags=unit ./...
 21 
 22+sass-slug:
 23+	mkdir -p static
 24+	sassc \
 25+		-I scss scss/main.scss static/main.$(COMMIT).css
 26+
 27 sass:
 28-	@mkdir -p static
 29+	mkdir -p static
 30 	sassc \
 31 		-I scss scss/main.scss static/main.css
 32 
 33diff --git a/templates/base.qtpl b/templates/base.qtpl
 34index 444afc639b5d8bc1c520d7b62edfe341c7d1bc06..d8d1d344fcc5a6f70683c0c3fd95494ec6055322 100644
 35--- a/templates/base.qtpl
 36+++ b/templates/base.qtpl
 37@@ -19,6 +19,9 @@         return ""
 38     }
 39 %}
 40 
 41+{% code 
 42+ var Slug = ""
 43+%}
 44 
 45 Page prints a page implementing Page interface.
 46 {% func PageTemplate(p Page) %}
 47@@ -27,7 +30,7 @@     <head>
 48         <meta charset="utf-8">
 49         <link rel="icon" href="data:,">
 50         <title>cerrado | {%= p.Title() %}</title> 
 51-        <link rel="stylesheet" href="/static/main.css">
 52+        <link rel="stylesheet" href="/static/main{%s Slug%}.css">
 53         <meta name="viewport" content="width=device-width, initial-scale=1" />
 54     </head>
 55     <body>
 56diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go
 57index 1d30cd8e314963b6c91ca782b6d32948044283ee..15c9e4f0ae2b83b1bb86993cb9e15a280a821318 100644
 58--- a/templates/base.qtpl.go
 59+++ b/templates/base.qtpl.go
 60@@ -54,22 +54,29 @@ 	}
 61 	return ""
 62 }
 63 
 64+//line base.qtpl:23
 65+var Slug = ""
 66+
 67 // Page prints a page implementing Page interface.
 68 
 69-//line base.qtpl:24
 70+//line base.qtpl:27
 71 func StreamPageTemplate(qw422016 *qt422016.Writer, p Page) {
 72-//line base.qtpl:24
 73+//line base.qtpl:27
 74 	qw422016.N().S(`
 75 <html lang="en">
 76     <head>
 77         <meta charset="utf-8">
 78         <link rel="icon" href="data:,">
 79         <title>cerrado | `)
 80-//line base.qtpl:29
 81+//line base.qtpl:32
 82 	p.StreamTitle(qw422016)
 83-//line base.qtpl:29
 84+//line base.qtpl:32
 85 	qw422016.N().S(`</title> 
 86-        <link rel="stylesheet" href="/static/main.css">
 87+        <link rel="stylesheet" href="/static/main`)
 88+//line base.qtpl:33
 89+	qw422016.E().S(Slug)
 90+//line base.qtpl:33
 91+	qw422016.N().S(`.css">
 92         <meta name="viewport" content="width=device-width, initial-scale=1" />
 93     </head>
 94     <body>
 95@@ -83,144 +90,144 @@           </div>
 96         </nav>
 97         <div class="container">
 98             `)
 99-//line base.qtpl:43
100+//line base.qtpl:46
101 	p.StreamContent(qw422016)
102-//line base.qtpl:43
103+//line base.qtpl:46
104 	qw422016.N().S(`
105         </div>
106     </body>
107     `)
108-//line base.qtpl:46
109+//line base.qtpl:49
110 	p.StreamScript(qw422016)
111-//line base.qtpl:46
112+//line base.qtpl:49
113 	qw422016.N().S(`
114 </html>
115 `)
116-//line base.qtpl:48
117+//line base.qtpl:51
118 }
119 
120-//line base.qtpl:48
121+//line base.qtpl:51
122 func WritePageTemplate(qq422016 qtio422016.Writer, p Page) {
123-//line base.qtpl:48
124+//line base.qtpl:51
125 	qw422016 := qt422016.AcquireWriter(qq422016)
126-//line base.qtpl:48
127+//line base.qtpl:51
128 	StreamPageTemplate(qw422016, p)
129-//line base.qtpl:48
130+//line base.qtpl:51
131 	qt422016.ReleaseWriter(qw422016)
132-//line base.qtpl:48
133+//line base.qtpl:51
134 }
135 
136-//line base.qtpl:48
137+//line base.qtpl:51
138 func PageTemplate(p Page) string {
139-//line base.qtpl:48
140+//line base.qtpl:51
141 	qb422016 := qt422016.AcquireByteBuffer()
142-//line base.qtpl:48
143+//line base.qtpl:51
144 	WritePageTemplate(qb422016, p)
145-//line base.qtpl:48
146+//line base.qtpl:51
147 	qs422016 := string(qb422016.B)
148-//line base.qtpl:48
149+//line base.qtpl:51
150 	qt422016.ReleaseByteBuffer(qb422016)
151-//line base.qtpl:48
152+//line base.qtpl:51
153 	return qs422016
154-//line base.qtpl:48
155+//line base.qtpl:51
156 }
157 
158-//line base.qtpl:50
159+//line base.qtpl:53
160 type BasePage struct{}
161 
162-//line base.qtpl:51
163+//line base.qtpl:54
164 func (p *BasePage) StreamTitle(qw422016 *qt422016.Writer) {
165-//line base.qtpl:51
166+//line base.qtpl:54
167 	qw422016.N().S(`Empty`)
168-//line base.qtpl:51
169+//line base.qtpl:54
170 }
171 
172-//line base.qtpl:51
173+//line base.qtpl:54
174 func (p *BasePage) WriteTitle(qq422016 qtio422016.Writer) {
175-//line base.qtpl:51
176+//line base.qtpl:54
177 	qw422016 := qt422016.AcquireWriter(qq422016)
178-//line base.qtpl:51
179+//line base.qtpl:54
180 	p.StreamTitle(qw422016)
181-//line base.qtpl:51
182+//line base.qtpl:54
183 	qt422016.ReleaseWriter(qw422016)
184-//line base.qtpl:51
185+//line base.qtpl:54
186 }
187 
188-//line base.qtpl:51
189+//line base.qtpl:54
190 func (p *BasePage) Title() string {
191-//line base.qtpl:51
192+//line base.qtpl:54
193 	qb422016 := qt422016.AcquireByteBuffer()
194-//line base.qtpl:51
195+//line base.qtpl:54
196 	p.WriteTitle(qb422016)
197-//line base.qtpl:51
198+//line base.qtpl:54
199 	qs422016 := string(qb422016.B)
200-//line base.qtpl:51
201+//line base.qtpl:54
202 	qt422016.ReleaseByteBuffer(qb422016)
203-//line base.qtpl:51
204+//line base.qtpl:54
205 	return qs422016
206-//line base.qtpl:51
207+//line base.qtpl:54
208 }
209 
210-//line base.qtpl:52
211+//line base.qtpl:55
212 func (p *BasePage) StreamBody(qw422016 *qt422016.Writer) {
213-//line base.qtpl:52
214+//line base.qtpl:55
215 	qw422016.N().S(`HelloWorld`)
216-//line base.qtpl:52
217+//line base.qtpl:55
218 }
219 
220-//line base.qtpl:52
221+//line base.qtpl:55
222 func (p *BasePage) WriteBody(qq422016 qtio422016.Writer) {
223-//line base.qtpl:52
224+//line base.qtpl:55
225 	qw422016 := qt422016.AcquireWriter(qq422016)
226-//line base.qtpl:52
227+//line base.qtpl:55
228 	p.StreamBody(qw422016)
229-//line base.qtpl:52
230+//line base.qtpl:55
231 	qt422016.ReleaseWriter(qw422016)
232-//line base.qtpl:52
233+//line base.qtpl:55
234 }
235 
236-//line base.qtpl:52
237+//line base.qtpl:55
238 func (p *BasePage) Body() string {
239-//line base.qtpl:52
240+//line base.qtpl:55
241 	qb422016 := qt422016.AcquireByteBuffer()
242-//line base.qtpl:52
243+//line base.qtpl:55
244 	p.WriteBody(qb422016)
245-//line base.qtpl:52
246+//line base.qtpl:55
247 	qs422016 := string(qb422016.B)
248-//line base.qtpl:52
249+//line base.qtpl:55
250 	qt422016.ReleaseByteBuffer(qb422016)
251-//line base.qtpl:52
252+//line base.qtpl:55
253 	return qs422016
254-//line base.qtpl:52
255+//line base.qtpl:55
256 }
257 
258-//line base.qtpl:53
259+//line base.qtpl:56
260 func (p *BasePage) StreamScript(qw422016 *qt422016.Writer) {
261-//line base.qtpl:53
262+//line base.qtpl:56
263 }
264 
265-//line base.qtpl:53
266+//line base.qtpl:56
267 func (p *BasePage) WriteScript(qq422016 qtio422016.Writer) {
268-//line base.qtpl:53
269+//line base.qtpl:56
270 	qw422016 := qt422016.AcquireWriter(qq422016)
271-//line base.qtpl:53
272+//line base.qtpl:56
273 	p.StreamScript(qw422016)
274-//line base.qtpl:53
275+//line base.qtpl:56
276 	qt422016.ReleaseWriter(qw422016)
277-//line base.qtpl:53
278+//line base.qtpl:56
279 }
280 
281-//line base.qtpl:53
282+//line base.qtpl:56
283 func (p *BasePage) Script() string {
284-//line base.qtpl:53
285+//line base.qtpl:56
286 	qb422016 := qt422016.AcquireByteBuffer()
287-//line base.qtpl:53
288+//line base.qtpl:56
289 	p.WriteScript(qb422016)
290-//line base.qtpl:53
291+//line base.qtpl:56
292 	qs422016 := string(qb422016.B)
293-//line base.qtpl:53
294+//line base.qtpl:56
295 	qt422016.ReleaseByteBuffer(qb422016)
296-//line base.qtpl:53
297+//line base.qtpl:56
298 	return qs422016
299-//line base.qtpl:53
300+//line base.qtpl:56
301 }