-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjigsaw.pdf.html
764 lines (561 loc) · 18.9 KB
/
jigsaw.pdf.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style>
html, body { margin: 0; padding: 0; }
body { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }
a:link, a:visited { color: black; }
h1 { font-size: 30pt; }
h2 { font-size: 28pt; }
h3 { font-size: 25pt; }
p, li, dt, dd, td, th { font-size: 18pt; }
pre { font-size: 14pt; }
pre.small { font-size: 11pt; }
pre.code {
background-color: azure;
padding: 5px;
}
ul { list-style-type: square; }
.center { text-align: center; }
.slide { page-break-after: always;
min-height: 100mm;
padding: 40px;
border: 1px dotted black;
/*
background: -moz-linear-gradient( top, maroon, red);
*/
}
pre {
padding: 4px 4px 4px 4px;
border-top: #bbb 1px solid;
border-bottom: #bbb 1px solid;
background: #f3f3f3;
}
/*
for princexml (CSS3 paged media support)
@page { size: A4 landscape }
*/
</style>
</head>
<body>
<div class="presentation">
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="dynamic-website-generators">Dynamic (Web)Site Generators</h1>
<p><strong>The Biggies</strong> (PHP Rules!)</p>
<ul>
<li>WordPress</li>
<li>Drupal</li>
<li>Joomla!</li>
</ul>
<p>On your live production site requires</p>
<ul>
<li>database (e.g. mysql)</li>
<li>application server (e.g. mod_php)</li>
<li>web server (e.g. apache)</li>
</ul>
<p>On every request - (re)builds the page on-the-fly e.g. queries the database, runs scripts,
merges templates, etc.</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="static-website-generators--builders">Static (Web)Site Generators / Builders</h1>
<p>On your live production site requires</p>
<ul>
<li>
<p>web server (e.g. apache, ngnix, etc.) only</p>
</li>
<li><strong>NO</strong> database needed</li>
<li><strong>NO</strong> application server needed</li>
</ul>
<p>Note: You can even go “server-less” e.g.
host your site on a web service e.g. Amazon S3 (Simple Storage Service).</p>
<p>You build the complete site, that is, <strong>all pages</strong> “ahead-of-time”
on a “build” machine. You will end-up with a bunch of (static) ready-to-use
HTML, CSS and JS files (*). Upload to production site and you’re live
w/ a kind of “super cache”.</p>
<p>(*) and media files e.g. graphics, music recordings, etc.</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="static-website-generators--builders-1">Static (Web)Site Generators / Builders</h1>
<p><strong>The Biggies</strong> in 1999</p>
<ol>
<li>Macromedia Dreamweaver</li>
<li>Microsoft FrontPage</li>
<li>Netscape Composer</li>
</ol>
<p>And today?</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="case-study-php---the-right-way">Case Study: PHP - The Right Way</h1>
<p><strong>PHP - The Right Way</strong>
(web: <a href="http://www.phptherightway.com">phptherightway.com</a>,
github: <a href="https://github.com/codeguy/php-the-right-way">codeguy/php-the-right-way</a>)</p>
<p>Q: Built with _____?</p>
<ul>
<li>[ ] PHP</li>
<li>[ ] Perl</li>
<li>[ ] Python</li>
<li>[ ] Ruby</li>
<li>[ ] JavaScript (Node.js)</li>
</ul>
<p><img src="i/php-the-right-way.png" alt="" /></p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="case-study-php---the-wrong-way">Case Study: PHP - The Wrong Way</h1>
<p><strong>PHP - The Wrong Way</strong>
(web: <a href="http://www.phpthewrongway.com">phpthewrongway.com</a>,
github: <a href="https://github.com/binarygenius/phpthewrongway">binarygenius/phpthewrongway</a>)</p>
<p>Q: Built with _____?</p>
<ul>
<li>[ ] Lisp</li>
<li>[ ] OCaml</li>
<li>[ ] Haskell</li>
<li>[ ] Reason</li>
<li>[ ] Elm</li>
</ul>
<p><img src="i/php-the-wrong-way.png" alt="" /></p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="case-study-answers">Case Study Answers</h1>
<p>PHP - The Right Way is built with… Ruby (and Jekyll).</p>
<p><strong>Jekyll</strong> ★29 707 (<a href="http://jekyllrb.com">jekyllrb.com</a>) - a popular static (web)site builder -
it’s built into GitHub and includes free hosting and more.</p>
<p>PHP - The Wrong Way is built with… Haskell (and Pandoc).</p>
<p><strong>Pandoc</strong> ★8 687 (web: <a href="http://pandoc.org">pandoc.org</a>) - a popular plain text (e.g. markdown)
to hypertext (e.g. markup) converter
includes templating too - thus, it’s another (great) static (web)site builder.</p>
<p>Q: Any static (web)site builders in PHP?</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="hello-jigsaw">Hello, Jigsaw!</h1>
<p>by Adam Wathan, Keith Damiani et al (★624) -
web: <a href="http://jigsaw.tighten.co">jigsaw.tighten.co</a>,
github: <a href="https://github.com/tightenco/jigsaw"><code>tightenco/jigsaw</code></a></p>
<p><img src="i/jigsaw-new-site.png" alt="" /></p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="why-jigsaw-why-yet-another-static-site-builder">Why Jigsaw? Why (yet) another static site builder?</h1>
<p>Build for Laravel (PHP) developers!</p>
<p>Started in April 2016 -
see
<a href="https://blog.tighten.co/introducing-jigsaw-a-static-site-generator-for-laravel-developers">“Introducing Jigsaw, a Static Site Generator for Laravel Developers”</a>
by Matt Stauffer</p>
<p>Q: Do you use (know) Laravel’s Blade templating language?</p>
<p>A: Yes. Good news. Now use what you know (and PHP)
to build static (web)sites too.</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="why-blade-why-yet-another-php-template-language">Why Blade? Why (yet) another PHP template language?</h1>
<p>Plain PHP Templates - Isn’t PHP the (best) template language?
Does PHP need a (new) template language?</p>
<p>Why Blade?</p>
<ul>
<li>Compiled</li>
<li>“Simpler Syntax”
<ul>
<li>Built-in Template Inheritance</li>
<li>(Content) Blocks</li>
<li>“Language-Independent” e.g. looks (more) like other popular template languages</li>
<li>“Designer-Friendly”</li>
</ul>
</li>
</ul>
<pre><code>@extends('_layouts.master')
@section('body')
<h1>Hello World!</h1>
@endsection
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="getting-started-with-jigsaw">Getting Started with Jigsaw</h1>
<p>Step 1: Install Jigsaw (using Composer)</p>
<pre><code>$ composer global require tightenco/jigsaw
</code></pre>
<p>Step 2: Try it</p>
<pre><code>$ jigsaw
</code></pre>
<p>prints</p>
<pre><code>Jigsaw version 1.0.1
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages:
1 for normal output,
2 for more verbose output and
3 for debug
Available commands:
build Build your site.
help Displays help for a command
init Scaffold a new Jigsaw project.
list Lists commands
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="getting-started-with-jigsaw-cont---commands">Getting Started with Jigsaw Cont. - Commands</h1>
<ul>
<li><strong>Init Command</strong> - Scaffold a new Jigsaw project</li>
<li><strong>Build Command</strong> - Build your site</li>
</ul>
<p>Try it:</p>
<pre><code>$ jigsaw init mysite
</code></pre>
<p>will produce</p>
<pre><code>│ config.php
│ gulpfile.js
│ package.json
└───source/
│ index.blade.php
├───css/
│ main.css
├───_assets/
│ └───sass/
│ main.scss
└───_layouts/
master.blade.php
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="getting-started-with-jigsaw-cont---commands-1">Getting Started with Jigsaw Cont. - Commands</h1>
<pre><code>$ cd mysite
$ jigsaw build
Site built successfully!
</code></pre>
<p>will result into:</p>
<pre><code>build_local/
│ index.html
└───css/
main.css
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="layouts---example-layoutsmasterbladephp">Layouts - Example: layouts/master.blade.php</h1>
<pre><code><!DOCTYPE html>
<html>
<head>
<title>Your Site Title</title>
</head>
<body>
<header>
Static Site Sample
</header>
@yield('contents')
<footer>
<p>Built w/ Jigsaw</p>
</footer>
</body>
</html>
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="jigsaw-stay-static-site---html-templates---includes">Jigsaw Stay Static Site - HTML Templates - Includes</h1>
<pre><code><!DOCTYPE html>
<html>
<head>
...
</head>
<body>
@include('_includes.github')
@include('_includes.header')
<div class="main">
@yield('body')
</div>
@include('_includes.footer')
</body>
</html>
</code></pre>
<p>(Source: <a href="https://github.com/staystatic/staystatic/blob/master/jigsaw/source/_layouts/master.blade.php">staystatic/jigsaw/source/_layouts/master.blade.php</a>)</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="pages-in-html---example-indexbladephp">Pages in HTML - Example: index.blade.php</h1>
<pre><code>@extends('_layouts.master')
@section('body')
<h1>Hello world!</h1>
@endsection
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="pages-in-markdown---example-aboutmd">Pages in Markdown - Example: about.md</h1>
<p>Use <code>.markdown</code> or <code>.md</code> extension
and start the page with a front matter block (in YAML).</p>
<pre><code>---
extends: _layouts.master
section: body
---
Hello, Jigsaw!
Welcome to markdown madness. We hope you **really** enjoy using good old text for writing.
Just type some [markdown](http://en.wikipedia.org/wiki/Markdown)
and Jigsaw (w/ ) will automatically turn it into hypertext markup language (HTML).
*Simple as that.*
> Quote goes here.
A list:
- One
- Two
- Three
Some inline code `to_html` and a preformatted code block:
<?php echo 'Hello, World!'; ?>
Or try
# Heading 1
## Heading 2
### Heading 3
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="markdown-madness---parsedown">Markdown Madness - Parsedown</h1>
<p>Jigsaw uses Parsedown (out-of-the-box).</p>
<p>What’s Parsdown?</p>
<p>Markdown Parser in PHP. One File // Super Fast // Extensible // GitHub Flavored</p>
<pre><code>$Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!');
</code></pre>
<p>See <a href="http://parsedown.org"><code>parsedown.org</code></a></p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="markdown-madness---parsedown-cont">Markdown Madness - Parsedown Cont.</h1>
<p>Includes GitHub Flavored Markdown Extensions e.g.</p>
<ul>
<li>Fenced Code Blocks</li>
<li>Tables</li>
<li>and more</li>
</ul>
<p>Includes Markdown Extra Extension e.g.</p>
<ul>
<li>Footnotes</li>
<li>Definition Lists</li>
<li>and more</li>
</ul>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="pages-in-markdown-w-custom-front-matter---example-layoutspagebladephp--historymd">Pages in Markdown w/ Custom Front Matter - Example: layouts/page.blade.php + history.md</h1>
<p>layouts/page.blade.php:</p>
<pre><code>@extends('_layouts.master')
@section('body')
<div class="page">
<h2>{{ $page->title }}</h2>
</div>
@yield('page-body')
@endsection
</code></pre>
<p>history.md:</p>
<pre><code>---
extends: _layouts.page
section: page-body
title: The History of Jigsaw
---
Build for Laravel (PHP) developers!
Started in April 2016 (this year) -
see ["Introducing Jigsaw, a Static Site Generator for Laravel Developers"](https://blog.tighten.co/introducing-jigsaw-a-static-site-generator-for-laravel-developers)
by Matt Stauffer (the Laravel lead)
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="global-site-wide-variables---example-configphp">Global site-wide variables - Example: config.php</h1>
<p>Add global site-wide variables
to the <code>config.php</code>:</p>
<pre><code><?php
return [
'site_title' => '"Your Site Title',
];
</code></pre>
<p>And use like (in templates):</p>
<pre><code><head>
<title>{{ $page->site_title }}</title>
</head>
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="collections">Collections</h1>
<p>Added to Jigsaw in 1.0 in April 2017. Yeah!</p>
<p><a href="https://blog.tighten.co/supercharged-static-sites-introducing-jigsaw-collections">Article: Supercharged Static Sites: Introducing Jigsaw Collections</a> by Keith Damiani (Tighten Co)</p>
<p>Add collections to <code>config.php</code>. Example:</p>
<pre><code><?php
return [
'collections' => [
'posts' => [
'path' => 'blog/{date|Y-m-d}/{filename}', // output path
'sort' => 'date',
],
'people' => [
'path' => 'people',
'sort' => 'last_name',
],
],
];
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="collections-cont">Collections Cont.</h1>
<p><code>posts</code> collects all document in <code>_posts</code> folder e.g.:</p>
<pre><code>_posts/
new-build-system.md
new-repo-maps.md
new-season.md
</code></pre>
<p><code>people</code> collects all document in <code>_people</code> folder e.g.:</p>
<pre><code>_people/
adam-wathan.md
dan-sheetz.md
dave-hicking.md
keith-damiani.md
matt-stauffer.md
</code></pre>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="jigsaw-stay-static-site---html-templates---loops">Jigsaw Stay Static Site - HTML Templates - Loops</h1>
<pre><code><div>
<b>News 'n' Updates</b>
<ul class="news">
@foreach($posts as $post)
<li><a href="{{ $page->baseUrl }}{{ $post->getPath() }}">{{ $post->title }}</a></li>
@endforeach
</ul>
</div>
</code></pre>
<p>(Source: <a href="https://github.com/staystatic/staystatic/blob/master/jigsaw/source/index.blade.php">staystatic/jigsaw/source/index.blade.php</a>)</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="datafiles">Datafiles</h1>
<p>Added assoc arrays to <code>config.php</code>. Example:</p>
<pre><code><?php
return [
'links' => [
[ 'title' => "football.db - Open Football Data",
'url' => "https://github.com/openfootball",
],
[ 'title' => "beer.db - Open Beer, Brewery 'n' Brewpub Data",
'url' => "https://github.com/openbeer",
],
[ 'title' => "world.db - Open World Data",
'url' => "https://github.com/openmundi",
]
],
</code></pre>
<p>(Source: <a href="https://github.com/staystatic/staystatic/blob/master/jigsaw/config.php">staystatic/jigsaw/config.php</a>)</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="jigsaw-stay-static-site---html-templates---loops-1">Jigsaw Stay Static Site - HTML Templates - Loops</h1>
<pre><code><div>
<b>Links 'n' Bookmarks</b>
<ul class="links">
@foreach($page->links as $link)
<li><a href="{{ $link->url }}">{{ $link->title }}</a></li>
@endforeach
</ul>
</div>
</code></pre>
<p>(Source: <a href="https://github.com/staystatic/staystatic/blob/master/jigsaw/source/index.blade.php">staystatic/jigsaw/source/index.blade.php</a>)</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="jigsaw---summary">Jigsaw - Summary</h1>
<table>
<thead>
<tr>
<th>-</th>
<th>Jigsaw</th>
</tr>
</thead>
<tbody>
<tr>
<td>GitHub Stars (+1s)</td>
<td>★624</td>
</tr>
</tbody>
<tbody>
<tr>
<td>Settings / Configuration</td>
<td>PHP</td>
</tr>
<tr>
<td>HTML Templates</td>
<td>Blade</td>
</tr>
<tr>
<td>. Layouts</td>
<td>Yes</td>
</tr>
<tr>
<td>. Includes</td>
<td>Yes</td>
</tr>
<tr>
<td>Front Matter / Meta Data</td>
<td>Yaml</td>
</tr>
<tr>
<td>Datafiles</td>
<td>PHP</td>
</tr>
<tr>
<td>CSS Preprocessing</td>
<td>No (*)</td>
</tr>
<tr>
<td>HTML “Shortcodes”</td>
<td>Markdown</td>
</tr>
</tbody>
</table>
<p>(*) Use “External” Pipeline e.g. Preprocessor in JavaScript (Node.js) etc.</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="thanks---stay-static">Thanks - Stay Static</h1>
<p><strong>Stay Static Sample Sites (Showcase)</strong></p>
<ul>
<li><a href="http://staystatic.github.io">Stay Static</a>
<ul>
<li><a href="https://github.com/staystatic/staystatic/tree/master/jigsaw"><code>/jigsaw</code></a></li>
<li><a href="https://github.com/staystatic/staystatic/tree/master/hugo"><code>/hugo</code></a></li>
<li><a href="https://github.com/staystatic/staystatic/tree/master/jekyll"><code>/jekyll</code></a></li>
<li><a href="https://github.com/staystatic/staystatic/tree/master/middleman"><code>/middleman</code></a></li>
<li><a href="https://github.com/staystatic/staystatic/tree/master/metalsmith-handlebars"><code>/metalsmith-handlebars</code></a></li>
<li><a href="https://github.com/staystatic/staystatic/tree/master/metalsmith-nunjucks"><code>/metalsmith-nunjucks</code></a></li>
<li><a href="https://github.com/staystatic/staystatic/tree/master/gatsby"><code>/gatsby</code></a></li>
</ul>
</li>
</ul>
<p>And more.</p>
</div>
<div class='slide '>
<!-- _S9SLIDE_ -->
<h1 id="bonus-more-jigsaw-sample-sites">Bonus: More Jigsaw Sample Sites</h1>
<ul>
<li><a href="http://jigsaw.tighten.co">Jigsaw Site</a> <a href="https://github.com/tightenco/jigsaw-site">(Source)</a></li>
<li><a href="https://tightenco.github.io/jigsaw-collections-demo">Jigsaw Collections Demo</a> <a href="https://github.com/tightenco/jigsaw-collections-demo">(Source)</a></li>
</ul>
</div>
</div> <!-- presentation -->
</body>
</html>