jeremyharris/build
最新稳定版本:0.5
Composer 安装命令:
composer require jeremyharris/build
包简介
Static PHP website builder
README 文档
README
Build
A little static site generator, built specifically to build little sites with blog posts.
Installation
composer require jeremyharris/build
Features
- Stupid dumb easy setup (no config files)
- Concatenates assets
- Builds only modified files
- Some tools for basic blog functionality
- Flexible-ish
Usage
$build = new \JeremyHarris\Build\Build('/path/to/site_target', 'path/to/build_target'); $build->build();
Only files that have been modified since you last built will be built. You can
optionally pass true to build() to force build all files. You can then get
full paths to newly built files:
$newlyBuiltFiles = $build->getBuiltFiles(); // now deploy them!
If you want to manually add build files that aren't within the expected structure, you can do so:
// add a file to the build root $build->addFileToBuild('/full/path/to/file.html'); // add a file to a new directory within the build $build->addFileToBuild('/full/path/to/file.html', 'some/directory'); // render a file as a view (wrap it in the layout) $build->addFileToBuild('/path/to/my.php', 'some/directory', true); $build->addFileToBuild('/path/to/my.md', '/', true);
Blogging
Some blogging functionality is provided in the \JeremyHarris\Build\Blog class.
It assumes a YYYY/MM structure. The Blog class is helpful for building an
archive page or getting the latest post. Items returned are \JeremyHarris\Build\Blog\Post
objects that contain some helpful methods.
$Blog = new Blog('/path/to/site_target'); $latest = $Blog->getLatest(); $allPosts = $Blog->getPosts(); $linkToLatest = $latest->link(); $latestTitle = $latest->title();
RSS
To create an RSS feed, you must tell the builder that you want one and pass some required settings that the feed needs in order to generate:
$build = new \JeremyHarris\Build\Build('/path/to/site_target', 'path/to/build_target'); $build->addRss('My Blog', 'https://example.com', 'Description of site'); $build->build();
The generator will then automatically create a basic RSS feed for you. The file will be in the root of your built site. Only the last 20 blog posts will be included in the feed.
Site target structure
The site target should have a layout like the one below. Anything in /webroot
is copied directly to webroot, allowing flexibility in not using views. Items
in /views are wrapped in layout.php and placed into the directories they
reside in. Views can be php or markdown.
Titles are assumed from the filename slug, so interesting-article-about-things.md
is titled "Interesting Article About Things".
site
|_ views
| |
| |_ about.php
| |_ contact.md
| |_ sub
| |_ article.php
|_ assets
| |_ css
| | |_ css1.css
| | |_ css2.css
| |
| |_ js
| |_ script1.js
| |_ script2.js
|
|_ webroot
| |_ robots.txt
| |_ fonts
| |_ font1.otf
|
|_ layout.php
And builds it into a site like this:
build
|_ fonts
| |_ font1.otf
|
|_ sub
| |_ article.html
|
|_ styles.css
|_ scripts.js
|- rss.xml
|_ about.html
|_ contact.html
|_ robots.txt
Note rss.xml will only exist if you added an RSS feed before build.
Example site
jeremyharris/build 适用场景与选型建议
jeremyharris/build 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 03 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jeremyharris/build 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jeremyharris/build 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-06