drozzi-pro/wp-theme 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drozzi-pro/wp-theme

Composer 安装命令:

composer create-project drozzi-pro/wp-theme

包简介

Theme Wordpress for development. Includes: Webpack

README 文档

README

Example of using Vite + TailwindCSS in Wordpress Theme development. Auto generating CSS, auto refresh on every file save/edit and easy production build tool with no hassle. Inspired by vitejs/vite#341

Main features

  • fast Auto browser refresh/sync file change/save
  • built in Tailwindcss Just-in-time compiler
  • extremely small CSS as there is no unsued css at all
  • keep your local domain while developing
  • npm run build for production packing Javascript and CSS

Installation (Node.js/npm required):

Clone or Unpack and copy folder to your Wordpress installation /wp-content/themes/ folder, or install theme via wp-admin by uploading .zip file and activate the theme. Then from your console or command prompt go to the theme folder and run npm install. Note: NodeJS is requred.

npm install

Quick commands:

# dev server start
npm run dev

# production build
npm run build

Setup

Entry point file main.js is where you include all your scripts and styles. It can be changed via vite.config.json and functions.php.

# get styles
import "./assets/css/styles.css"

# get scripts
import "./assets/js/scripts.js"

Development with live preview/refresh

Ensure define("IS_VITE_DEVELOPMENT", true); exists in your wp-config.php or theme/plugin functions.php. Just run npm run dev and refresh your development website.

npm run dev

After Vite dev server is started open your installed Wordpress website in any browser or refresh it. Then you can start editing index.php, or any other php file in your theme, by adding elements and Tailwind classes. After saving changes your browser page eg your site should refresh immediately. You can freely edit asset files like styles.css, scripts.js too.

Production build

Just run npm run build, set defined IS_VITE_DEVELOPMENT to false and refresh local website.

npm run build

Wordpress should load now production generated assets.

Note: To ensure classes used inside CMS to be processed just add them to safelist.txt and run build again.

Sass / Less

CSS Pre-processors are also supported by ViteJS

# .scss and .sass
npm add -D sass

# .less
npm add -D less

Please check link for details. https://vitejs.dev/guide/features#css-pre-processors

Note for httpS serving

If your local development domain is served via https:// then generating certificate for localhost usage and some changes in config are required

# install mkcert
choco install mkcert

# global one time install
mkcert -install

# run in project/theme folder to create localhost-key.pem & localhost.pem 
mkcert localhost
  • enable server.https option in vite.config.js
  • change VITE_SERVER to https in your functions.php

Customizations

More info on the links below

Visual Studio Code Tailwind Intellisense plugin is a must. https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss

That's it.

Happy coding! :)

Change log

v0.3.2

  • Refresh speed improved (file search pattern fixed in tailwind.config.js)
  • Package name changed
  • Vite script loading logic moved to inc/inc.vite.php
  • Homepage updated
  • Hashed assets filenames on build, force reload not needed

v0.3.1

  • Demo layout updated
  • Hello World preview image replaced
  • Package updates:
    • postcss ^8.4.7 → ^8.4.12
    • autoprefixer ^10.4.2 → ^10.4.4
    • vite ^2.8.6 → ^2.9.1

v0.3.0

  • Tailwindcss 3 config fixes

Packages updates:

  • autoprefixer ^10.2.5 → ^10.4.2
  • postcss ^8.2.14 → ^8.4.7
  • postcss-nested ^5.0.5 → ^5.0.6
  • tailwindcss ^2.1.2 → ^3.0.23
  • vite ^2.2.4 → ^2.8.6

v0.2.7

  • Tailwind updated to 2.2.16
  • PostCSS updated to v8.3.8
  • Autoprefixer updated to 10.3.6
  • Vite updated to v2.6.2

v0.2.6

  • Tailwind updated to 2.2.15
  • Vite updated to v2.5.7
  • Autoprefixer updated to 10.3.4
  • PostCSS updated to v8.3.6
  • PostCSS-Nested updated to 5.0.6
  • IS_VITE_DEVELOPMENT check fix

v0.2.5

  • PostCSS updated to v8.2.14

v0.2.4

  • https solution added
  • 404.php template file added

v0.2.3

  • Vite updated to v2.2.4
  • PostCSS updated to v8.2.13
  • Tailwindcss updated to v2.1.2
  • https option included into server vite.config.js

v0.2.2

  • small workaround added in order Tailwindcss Intellisense to work
  • postcss package updated to v8.2.10
  • index.php splited into header.php & footer.php
  • example page.php template with responsive container added

v0.2.1

  • TailwindCSS updated to 2.1.1 (JIT is included in this version)
  • experimental @tailwindcss/jit removed
  • functions.php cleanup
  • tailwind.config.js, mode 'JIT' added (v2.1.1)
  • postcss.config.js updated

v0.1.0

  • initial release

drozzi-pro/wp-theme 适用场景与选型建议

drozzi-pro/wp-theme 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 09 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 drozzi-pro/wp-theme 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 drozzi-pro/wp-theme 我们能提供哪些服务?
定制开发 / 二次开发

基于 drozzi-pro/wp-theme 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-09-07