boilerplate for wordpress theme development
-
ライブラリのインストール 下記のいずれか
npm install
yarn -
sanitize.cssなどをbuild
npx gulp build
/assetsディレクトリが生成される
- 作成時のミドルウェアバージョンは以下
$ npm -v
8.1.2
$ node -v
v16.13.1- 画像やjsやcssはsrc配下へ配置すること
- 画像をsrcへ配置したあとは
gulp buildを実行するとassetsに画像が配置される - ローカル環境で開発をする際には、
yarn startを実行するとファイル監視状態になる - .scssファイルとjsファイルは編集するとコンパイルされたファイルが
assetsに配置される
├─themes/your-theme # theme root
├─ index.php
├─ functions.php
├─ style.css
├─ assets # compiled files
│ ├─ img
│ ├─ css
│ └─ js
├─ src # original files
│ ├─ img
│ ├─ css
│ └─ js
├─.gitignore- npm or yarn
- gulp
- docker
- wp-env
- composer
- phpcs
phpcs.executablePath
phpcbf.executablePathwp-env start #start wpenv
wp-env stop #close wpenv
wp-env start --update #update plugins下記コマンドでブロック開発監視モードに変わる。
初期はsrc/index.jsが監視対象
npm run start-buildwp-env run cli wp start developing with
npm startbuild css js img files
gulp build/.github/workflowsのymlファイルに自動デプロイ環境が設定可能。
SECRETSの値とブランチは環境に合わせて要調整。
color: var(--wp--preset--color--priary);
font-family: var(--wp--preset--font-size--font-lm);h2 {
font-size: 24px;
@include mq() {
font-size: 18px;
}
}<br class="sp">All in on migrationのプラグインで大容量データをインポートするときに利用可能。
wp-env run cli vi .htaccess.htaccessファイルを開いて下記設定を追記
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300