schornio / static-website-generator
服务器上从 Handlebar 模板生成文件
v5.4.0
2021-05-06 12:38 UTC
Requires
- erusev/parsedown: ^1.7
- guzzlehttp/guzzle: ^6.3
- phpmailer/phpmailer: ^6.4
- zordius/lightncandy: ^1.2
- dev-master
- v5.4.0
- v5.3.1
- v5.3.0
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.0
- v5.0.0
- v4.1.0
- v4.0.1
- v4.0.0
- v3.1.1
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.8.0
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- dev-dependabot/composer/guzzlehttp/psr7-1.9.1
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-dependabot/composer/phpmailer/phpmailer-6.5.0
This package is auto-updated.
Last update: 2024-09-19 21:59:49 UTC
README
composer require schornio/static-website-generator
脚本
- sio-swg-compile: 将
./components编译为 stdout php 脚本 - sio-swg-generator: 每个组件都有机会在渲染时运行脚本(
generator.php,function <component_name>_generator ()) - sio-swg-render: 用给定的 Storyblok 内容覆盖
./dist
Handlebar 辅助函数
echojoinreplacetoJSONtoAlphaNumequalswitchcasesplituseDynamicmarkdowngetStorygetStoriesgetCurrentStoryurlresizeresolveSlugtextToSlugisActiveStoryrenderTimestampformatDatestoryblokToken- (
storyblokBridge)
图像处理器必须位于 public/images
RewriteCond %{REQUEST_URI} ^/public/images/.+
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ public/imageProcessor.php [L]
静态(.html)和动态(.php)内容之间的区别
hbs-helper {{useDynamic}} 标记模板为动态内容。如果渲染链中至少有一个模板被标记为动态,则生成的文件将以 .php 结尾,而不是 .html。
{{useDynamic}}
<?php
// Dynamic content here
$data = json_decode("{{{toJSON data}}}");
?>
特殊的 slug --fileextension-
如果 slug 包含 (filename)--fileextension-(extension),则文件将被存储为 (filename).(extension)。例如,sitemap--fileextension-xml 将被转换为 sitemap.xml