batch/craft
Composer 安装命令:
composer create-project batch/craft
包简介
Batch's Composer starter project for Craft CMS
README 文档
README
Batch Craft Starter
An opinionated Craft CMS project starter that integrates Vue.js, Tailwind CSS and Docksal configuration.
Explore the docs »
Report Bug ·
Request Feature
Table of Contents
About The Project
The idea behind this project was to create a Craft CMS starter that allows us to get up and running and developing on projects quickly.
This starter comes set up, ready for for development with:
- Tailwind CSS
- Vue.js
- craft-webpack - our Webpack build configuration
- Craft CMS with Twigpack
- Jest for frontend testing
- Docksal configuration
Built With
Getting Started
To create a new project using this starter, follow the below steps.
Prerequisites
In order to use the this starter, you'll need to have Docksal up and running. You can find instructions at https://docksal.io/.
Installation
Create a new project via composer
fin rc composer create-project batch/craft myproject --remove-vcs
Replace 'myproject' with the desired project directory name.
Note: We recommend using Docksal's fin rc and fin exec commands, which will execute the commands on a standalone 'cli' container mapped to the current directory. This ensures the commands will run even if Composer or NPM are not installed locally.
The --remove-vcs flag will removes the batch/craft git metadata so this will be ready for use in a project repository.
Run the installer
We include an installer script that will finish setting up your project:
fin batch/install
After executing this and following the prompts your project should be available at the configured domain, and you should see a demo page to confirm.
This command sets up SSL certificates using mkcert, runs the Craft installer, installs the Twigpack plugin and npm dependencies and performs an initial build of the frontend assets. If you wish to do these steps manually, see the instructions below.
Manual installation
- Generate an SSL certificate. We recommend using the mkcert global addon which can be installed with:
fin addon install --global mkcert
fin mkcert create
- Start up the Docksal container
fin up
- Install Craft via the CLI
fin exec craft install
- Install the Twigpack plugin
fin exec craft plugin/install twigpack
- Install npm dependencies
fin exec npm install
- Build the asset files
fin exec npm run build
That's it! Your new project should now be available at the configured domain and you should see a demo page to confirm.
Usage
Webpack / Build Tool
Install the depdendencies for the build tool
fin exec npm install
Production
fin exec npm run build
Development
Run the development pipeline on the Docksal container. It will be available at webpack.{yourdomain}
fin exec npm run dev
Use the following commands to specifically generate a legacy or combined browser build during development
fin exec npm run dev-legacy fin exec npm run dev-combined
Build Configuration
Settings
The build settings in webpack.settings.js can be overridden at a project level by placing a webpack.settings.js file in the project root. This will be merged with the base webpack.settings.js file during build.
Example:
module.exports = { paths: { src: { base: "./resources/", css: "./resources/css/", js: "./resources/js/" } } };
Webpack Config
Any custom Webpack config can be included by adding a webpack.config.js in the project root. This will be merged with the final Webpack config during build.
Example:
const path = require("path"); module.exports = { resolve: { alias: { "#": path.resolve(__dirname, "src/vue/") } } };
We have provided a set of defaults to alias the src/ paths and additional entry points.
Craft Plugins
Use the fin exec craft plugin/install command to install any additional plugins.
Twigpack is required, and installed by default. We also include the following common plugins in the composer.json dependencies:
- Mailgun -
fin exec craft plugin/install mailgun - Redactor -
fin exec craft plugin/install redactor - SEOMatic -
fin exec craft plugin/install seomatic - Freeform -
fin exec craft plugin/install freeform - Navigation -
fin exec craft plugin/install navigation
Mixing Inline Scripts with Vue
On occasion we've found the need to run vanilla JS inline within a template (e.g. with Craft Commerce) and only run this code when our Vue app has mounted.
Our solution is to provide an event bus available at window.app that is instantiated within the head of the document via critical.js. To use the event bus, simply subscribe and publish to events like so:
Example: Subscribing to events
<script type="text/javascript"> window.app.on("vue-mounted", () => { alert("vue has mounted!"); }); </script>
Example: Publishing events
mounted() { window.app.emit("vue-mounted"); }
The vue-mounted event is provided out of the box to hook into from your twig templates.
Testing
Frontend
The starter comes with Jest installed and configured, plus the Vue testing framework helper library. To run the test suite, you can use the command
fin exec npm run test.
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Contact
- Jude Reid - @batchnz - jude@batch.nz
- Alex Hatzipanis - @hatzipanis - alex@batch.nz
Project Link: https://github.com/batchnz/craft
Acknowledgements
Thanks to all the hard work by the teams behind the tools used in this project.
batch/craft 适用场景与选型建议
batch/craft 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 12, 最近一次更新时间为 2020 年 11 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「project」 「Craft」 「craftcms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 batch/craft 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 batch/craft 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 batch/craft 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Expand, collapse, change the status of, or delete multiple blocks in a Matrix field simultaneously.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Integrate with Snipcart.
Task system for APPUI
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unlicense
- 更新时间: 2020-11-05