Lightweight starter kit to use ViteJS 4 for WordPress plugin and theme development. Includes frontend and backend (PHP) utilities
Overview
ViteJS is a modern build tool that streamlines the development process for projects, particularly those using WordPress. With its focus on speed and simplicity, Vite offers an innovative approach that allows developers to efficiently manage assets while providing a seamless live reloading experience during development. This tool is especially beneficial for those looking to integrate various themes and plugin structures with ease.
The setup is designed to remain lightweight, ensuring that developers can customize it according to project needs. By leveraging modern JavaScript features and CSS frameworks, ViteJS serves as an excellent choice for those engaged in responsive and performance-driven web development.
Features
- Hot Module Replacement (HMR): Automatically updates the dev server when changes are made in PHP files, enhancing the development experience by providing instant feedback.
- JavaScript Encapsulation: JS bundles are encapsulated to prevent conflicts with global variables from other plugins and themes after minification, promoting better code management.
- Esbuild Integration: Configured to handle ReactJS code within .js files instead of .jsx and helps speed up the build process with smart minification options.
- Automatic Entry Inclusion: Uses fast-glob to automatically include JavaScript and CSS entries from the first-level folders in the src directory, streamlining asset management.
- Image Optimization: The built-in Vite Plugin Image Optimizer enhances image and SVG file performance by optimizing them for faster load times.
- PostCSS Configuration: Includes TailwindCSS and Autoprefixer, which ensure that CSS is clean, optimized, and maintains style consistency across different browsers.
- Composer Support: Integrates with Composer to facilitate the management of asset URLs allowing for simple registration and enqueuing through the provided package.
- Customizable TailwindCSS: Tailwind is configured to generate only the styles needed for the project, avoiding bloated CSS files and potential naming conflicts with a customizable prefix.