madebykind/craft-vue-tailwind
Composer 安装命令:
composer create-project madebykind/craft-vue-tailwind
包简介
Craft CMS + Vue.js + TailwindCSS + Nanobox Boilerplate
README 文档
README
What is it?
Fork of craft-vue-tailwind composer project template that integrates:
- Nanobox for development environments
- git-flow as a branching/release strategy
- CraftCMS for content management
- Fractal as a living styleguide
- Tailwind utility first CSS framework
- Purgecss for build optimisation
- Jest for front end unit tests
- Vuejs for fancypants JavaScript stuff
- Husky for git hooks
- Hygen for scaffolding components
- eslint & Prettier for linting and code formatting
Via the combined magic of composer and vue-cli to give you an all singing, all dancing, pre-configured dev environment
What's included?
- Webpack +
vue-loaderfor single file Vue components - State preserving hot-reload
- Page reloading on file edits (twig, html, etc)
- State preserving compilation error overlay
- Lint-on-save with ESLint
- Source maps
- Fractal living styleguide with asset sync
- Load styleguide twig templates in Craft by prefixing include name with
@
Requirements
This template requires the following software / packages to be installed in the host machine
Installing on a new machine? Not actually a developer? Install homebrew and then grab all the above apart from Nanobox at once:
brew install php composer node yarn git git-flow
NB if installing Nanobox for the first time be sure to follow the post-install instructions for recent versions of macOS
How to use
Creating a new project
# create & install project composer create-project madebykind/craft-vue-tailwind <path> cd <path> # install deps and basic setup ./scripts/project/after-install # customise the project yarn project:configure # apply environment settings yarn project:apply-env # install Craft in nanobox nanobox run # once you're inside the nanobox container yarn project:setup-craft # build fractal -> twig pathmap yarn build:components
Getting an existing project running
git clone <project-git-url> <path> cd <path> # create .env cp .env.example .env # install deps and basic setup ./scripts/project/after-install # install Craft yarn project:setup-craft
Accessing the CraftCMS database
By default Craft is set up to use Project Config, so you shouldn't often need to import / export a database from the site, however, if you do, you can get local mysql credentials in your host machine by running
nanobox info local
You can then use the credentials shown under data.db to access mysql via the cli or a GUI as you wish
Dev workflow...
Run the servers:
# run each of these in their own terminal pane
yarn serve
yarn test:watch
yarn serve:craft
Create a new front end component:
# Interactively skeleton a new component
yarn generate:component
Commands
Dev environment
yarn serve: start the webpack dev server + fractal server (NB this does not start the craft/PHP server, as you will often want this to run in another process)yarn serve:assetsstart the webpack server above but without fractal runningyarn serve:fractalstart the fractal serveryarn serve:craftstart the nanobox container that serves CraftCMS
Generators
Via Hygen, templates in _templates/
yarn generate:componentinteractively generate a new front end component
Linting
lintwhat you'd expectlint:autofixlint and fix automatically where possible (run automatically pre-commit and pre-push)lint:config-checkcheck the eslint config for rules that conflict with prettier
Tests
test:unitrun the unit tests (run automatically pre-push)test:watchrun the tests on code changetest:coveragecalc code coverage stats
Building for production
yarn build: Production ready build.- JavaScript minification with UglifyJS v3
- Babel compiling
- CSS across all components extracted into a single file and minified with cssnano
- Static assets compiled with version hashes for efficient long-term caching
- Removes unused CSS with Purgecss. Includes whitelister to keep third-party libraries untouched.
- Bundle size analytics
- Builds the living tyleguide to static HTML
Configuration (optional)
To edit the vue-cli config via the UI you will require Vue CLI 3 to be installed globally on your machine. You can run vue ui and import your the project to get started customising the configuration with vue-cli plugins of your choice.
NB By default the project uses a randomly allocated ports for webpack dev server and fractal server, which are set by the project:configure command run during project setup, stored project-wide under the kindConfig key in package.json and loaded into your .env file via the project:apply-env command.
In order for the UI to workvue-cli requires you to run the project on it's default port (8080). To use the UI to configure your project you'll therefore need to temporarily change ASSET_SERVER_PORT in your .env file to 8080 and restart your serve process, then change it back to its previous value once you've finished.
Under the hood
WTF is all this dark magic?
This project automates a lot of dull manual tasks. If you want to understand what's going on, here's a quick rundown
- After composer creates the project, it runs the
post-create-project-cmdscript, which:
- sets up your .env file
- replaces the project's composer.json with one that's specific for your project
- cleans up some files that aren't needed
- dumps composer's autoloader
-
runs
scripts/project/after-installwhich then...
How asset loading works
NOTE: During development, only your assets will be served from localhost:<ASSET_SERVER_PORT> and referenced in the base template. You'll still load your site locally under your normal development domain (mysite.test, etc.). This will also cause a brief unstyled flash on page loads due to JS/CSS assets loading from javascript for development. This flash isn't present after build, on production.
After running yarn build, the easiest way to test your build files locally is to comment the environment variable in your .env file, and refresh the page. This will serve your assets from the build directory, rather than webpack's dev server.
For a detailed explanation on how things work, check out the Vue CLI docs.
Babel Compiling
This boilerplate uses babel-preset-env for configuring babel. You can read more about it here.
Thanks
Forked from chasegiunta/craft-vue-tailwind
madebykind/craft-vue-tailwind 适用场景与选型建议
madebykind/craft-vue-tailwind 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 49 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 02 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「project」 「Craft」 「craftcms」 「vue」 「Vue.js」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 madebykind/craft-vue-tailwind 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 madebykind/craft-vue-tailwind 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 madebykind/craft-vue-tailwind 相关的其它包
同方向 / 同关键字的高下载量 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
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-14