Update Sculpin slides
This commit is contained in:
parent
78e1ccbd03
commit
7e21321c2f
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
title: My talk
|
name: My talk
|
||||||
foo: bar
|
|
||||||
menu_links:
|
menu_links:
|
||||||
- { title: About, href: / }
|
- { title: Home, href: / }
|
||||||
- { title: Talks, href: /talks/ }
|
- { title: About, href: /about }
|
||||||
|
|
BIN
building-static-websites-sculpin/images/packagist.png
Normal file
BIN
building-static-websites-sculpin/images/packagist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 126 KiB |
|
@ -35,23 +35,31 @@ What do I use it for?
|
||||||
* My personal website
|
* My personal website
|
||||||
* Some client websites
|
* Some client websites
|
||||||
* HTML prototypes and testing
|
* HTML prototypes and testing
|
||||||
* Learning YAML and Twig (and maybe some Symfony)
|
* Learning YAML and Twig (and some Symfony)
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
``composer require sculpin/sculpin``
|
``composer require sculpin/sculpin``
|
||||||
|
|
||||||
|
|
|
||||||
|
|
||||||
|
``composer create-project sculpin/blog-skeleton my-blog``
|
||||||
|
|
||||||
|
|
|
||||||
|
|
||||||
|
``composer create-project opdavies/sculpin-skeleton my-site``
|
||||||
|
|
||||||
Using Sculpin
|
Using Sculpin
|
||||||
=============
|
=============
|
||||||
|
|
||||||
* Configuration lives in ``app/config``
|
* Configuration lives in ``app/config``
|
||||||
* Source code lives in ``source``.
|
* Source files live in ``source``.
|
||||||
|
|
||||||
Generate a site
|
Generate a site
|
||||||
===============
|
===============
|
||||||
|
|
||||||
* ``sculpin generate``
|
* ``vendor/bin/sculpin generate``
|
||||||
* ``--server``
|
* ``--server``
|
||||||
* ``--watch``
|
* ``--watch``
|
||||||
* ``--env``
|
* ``--env``
|
||||||
|
@ -62,6 +70,18 @@ source/index.md
|
||||||
.. code-block:: markdown
|
.. code-block:: markdown
|
||||||
:include: code/index.md.txt
|
:include: code/index.md.txt
|
||||||
|
|
||||||
|
output_dev/index.html
|
||||||
|
=====================
|
||||||
|
|
||||||
|
.. code-block:: html
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Hello, World!</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
@ -70,9 +90,19 @@ Configuration
|
||||||
- ``sculpin_site_{env}.yml``
|
- ``sculpin_site_{env}.yml``
|
||||||
- Key-value pairs
|
- Key-value pairs
|
||||||
|
|
||||||
.. code-block:: markdown
|
.. code-block:: yaml
|
||||||
:include: code/configuration.txt
|
:include: code/configuration.txt
|
||||||
|
|
||||||
|
Using on pages
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. code-block:: html
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<title>{{ site.name }}</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
YAML front matter
|
YAML front matter
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
@ -142,6 +172,50 @@ Using on pages
|
||||||
<p>{{ testimonial.text }}</p>
|
<p>{{ testimonial.text }}</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
Layouts
|
||||||
|
=======
|
||||||
|
|
||||||
|
.. code-block:: twig
|
||||||
|
|
||||||
|
{# source/_layouts/app.html.twig #}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{{ site.locale|default('en') }}">
|
||||||
|
<head>
|
||||||
|
<title>{{ site.name|default('Sculpin Skeleton') }}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
Layouts
|
||||||
|
=======
|
||||||
|
|
||||||
|
.. code-block:: twig
|
||||||
|
|
||||||
|
{# source/_layouts/default.html.twig #}
|
||||||
|
|
||||||
|
{% extends 'app' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
Includes
|
||||||
|
========
|
||||||
|
|
||||||
|
.. code-block:: twig
|
||||||
|
|
||||||
|
{% include 'about-author' with {
|
||||||
|
avatar: site.avatar,
|
||||||
|
work: site.work,
|
||||||
|
} only %}
|
||||||
|
|
||||||
|
{% for link in links %}
|
||||||
|
{% include 'menu-link' with { link } only %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
Content types
|
Content types
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
@ -164,16 +238,58 @@ Accessing custom content types
|
||||||
use:
|
use:
|
||||||
- projects
|
- projects
|
||||||
---
|
---
|
||||||
|
|
||||||
{% for project in data.projects %}
|
{% for project in data.projects %}
|
||||||
<h2>{{ project.title }}</h2>
|
<h2>{{ project.title }}</h2>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
.. page:: titlePage
|
||||||
|
|
||||||
|
.. class:: centredtitle
|
||||||
|
|
||||||
|
Demo
|
||||||
|
|
||||||
|
.. page:: standardPage
|
||||||
|
|
||||||
Extending Sculpin
|
Extending Sculpin
|
||||||
=================
|
=================
|
||||||
|
|
||||||
* Custom (Symfony) bundles
|
.. code-block:: yaml
|
||||||
* Twig extensions
|
|
||||||
* Other Symfony components or PHP libraries
|
# app/config/sculpin_kernel.yml
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
services:
|
||||||
|
App\TwigExtension\TalkExtension:
|
||||||
|
tags:
|
||||||
|
- { name: twig.extension }
|
||||||
|
|
||||||
|
.. page:: imagePage
|
||||||
|
|
||||||
|
.. image:: images/packagist.png
|
||||||
|
:width: 22cm
|
||||||
|
|
||||||
|
.. page:: standardPage
|
||||||
|
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
:startinline: true
|
||||||
|
|
||||||
|
// app/SculpinKernel.php
|
||||||
|
|
||||||
|
use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle;
|
||||||
|
use Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel;
|
||||||
|
|
||||||
|
final class SculpinKernel extends AbstractKernel
|
||||||
|
{
|
||||||
|
protected function getAdditionalSculpinBundles(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
SculpinTwigMarkdownBundle::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Thanks!
|
Thanks!
|
||||||
=======
|
=======
|
||||||
|
@ -181,8 +297,8 @@ Thanks!
|
||||||
References:
|
References:
|
||||||
|
|
||||||
* https://sculpin.io
|
* https://sculpin.io
|
||||||
* https://github.com/sculpin/sculpin
|
* https://github.com/opdavies/sculpin-talk-demo
|
||||||
* https://github.com/opdavies/sculpin-skeleton
|
* https://github.com/opdavies/oliverdavies.uk
|
||||||
* https://github.com/opdavies/docker-image-sculpin-serve
|
* https://github.com/opdavies/docker-image-sculpin-serve
|
||||||
|
|
||||||
|
|
|
|
||||||
|
|
Loading…
Reference in a new issue