Skip to content

TheCodeCompany/enqueues

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ENQUEUES MU PLUGIN

Why Use Enqueues? (Key Benefits for Developers)

Enqueues MU Plugin is designed to make modern WordPress asset management effortless, scalable, and maintainable. Here’s why developers love it:

  • Automatic, Context-Aware Asset Loading:

    • Loads CSS/JS for each page type, template, or post type automatically, with smart fallback to defaults. No more manual enqueues for every template.
    • Block editor assets (blocks, plugins, extensions) are registered and loaded based on context and naming conventions.
  • Performance & Maintainability:

    • Caching for asset lookups and template scans means fewer filesystem hits and faster page loads.
    • Minified assets are served in production, unminified in dev for easy debugging.
    • Inline asset support for critical CSS/JS reduces render-blocking requests and improves perceived performance.
  • Extensible & Customizable:

    • Every aspect is filterable: dependencies, localization, handles, versions, media, directory structure, and more.
    • Modular controller-based architecture lets you enable/disable or extend features as needed.
  • Modern Build Integration:

    • Webpack JS utilities generate entry points and copy patterns automatically—no more manual config updates when adding new files.
    • Block editor assets are organized in scalable, maintainable subfolders.
  • Developer Experience:

    • Local dev warnings for missing builds help you catch issues early.
    • Autoloading and config management with environment-specific overrides.
    • Fully documented, standards-driven codebase.
  • Security & Best Practices:

    • All input is validated/sanitized, and output is escaped using WordPress best practices.
    • Custom code lives in MU-plugins, not in theme files, for clean separation and easier updates.

OVERVIEW

Enqueues MU Plugin is a modern, flexible system for automating and customizing asset loading in WordPress themes and plugins. It is designed for maintainability, performance, and extensibility—supporting both classic and block-based development.

Note: All Webpack automation features are optional. You can use only the PHP asset loading/controllers, or only the Webpack utilities, or both together. Loading and initializing controllers is also optional and context-dependent—see Quick Start for details.

FEATURES

QUICK START

  1. Install via Composer
    composer require thecodeco/enqueues:dev-main
  2. Initialize in your theme or plugin (Optional)
    \Enqueues\enqueues_initialize_controllers('theme');
    You only need to initialize controllers if you want to use the automated PHP asset loading features. You can use the Webpack utilities or other features independently.
  3. Start customizing!

HOW IT WORKS

  • Automatic Asset Loading: The plugin detects the current page type, template, or post type and loads the corresponding CSS/JS file. If no specific file is found, it falls back to main.js/main.css.
  • Block Editor Features: Easily register and manage custom blocks, block categories, and block editor plugins. Use filters to control dependencies, localization, and more.
  • Webpack Automation (Optional): Utilities help you keep your Webpack config in sync with your codebase, automatically generating entries and copying assets. You can use these utilities without using the PHP controllers.
  • Inline Asset Registration: Register critical CSS/JS for inline output in wp_head or wp_footer.
  • Extensive Filters: Fine-tune every aspect of asset loading, block registration, and build output. See the docs for a full list.

WHERE TO GO NEXT

DETAILED FILTERS & ADVANCED OPTIONS

For a full list of filters, advanced configuration, and real-world usage, see the relevant sections in each doc in the /docs/ folder.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published