AGENT SKILL
npm-scripts
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-06-24
- Stars
- ★ 67
- Forks
- 24
03 SKILL.md 正文
WP Rig npm scripts
This guide describes how to use the npm scripts defined in WP Rig's package.json for development, building, and maintenance.
Core Development Scripts
npm run dev: Starts the primary development workflow. It builds all assets and watches for changes.npm run build: Performs a one-time build of all CSS, JS, and block assets.npm run start: An alias for starting the dev process.
Build Scripts
npm run build:css: Builds only CSS files usingbuild-css.js.npm run build:js: Builds only JS/TS files usingbuild-js.js.npm run build:blocks: Builds all WordPress blocks located in the theme.npm run bundle: Creates a production-ready theme bundle in the parent directory.npm run bundle:phpcs: Same as bundle, but also runs PHPCS checks.
Initialization and Setup
npm run rig-init: Installs both npm and composer dependencies and initializes the theme. Use this for the first setup.npm run setup-child: Initializes the theme and creates a child theme usingchildify.js.
Code Quality and Linting
npm run lint:css: Lints all CSS files inassets/css/src/.npm run lint:js: Lints all JS/TS files inassets/js/src/.npm run build:phpcs: Runs PHPCS on the project.
WordPress Blocks
npm run block:new: Interactive command to create a new WordPress block.npm run block:new:dynamic: Create a new dynamic (PHP-rendered) WordPress block.npm run block:list: Lists all blocks in the theme.npm run block:remove: Interactive command to remove a block.npm run start:blocks: Watches and rebuilds blocks on change.
Testing
npm run test:e2e: Runs Playwright End-to-End tests.npm run test:e2e:ui: Opens Playwright UI for debugging tests.npm run test:e2e:screenshot: Captures regression screenshots using Playwright.
Utility Scripts
npm run images: Optimizes images in theassets/images/directory.npm run create-rig-component: Helper to create a new WP Rig component class ininc/.npm run mcp: Starts the Model Context Protocol server for documentation access.npm run generateCert: Generates local SSL certificates for development.
Best Practices for Agents
- Always use
npm run devwhen making changes to CSS or JS files to ensure they are compiled and you can see the results. - Use
npm run block:newinstead of manually creating block folders to ensure WP Rig's block structure is followed. - Run
npm run lint:cssandnpm run lint:jsbefore submitting changes to ensure code style consistency. - Use
npm run create-rig-componentto scaffold new PHP components in theinc/directory.