Helper class for working with Laravel Mix in WordPress themes and plugins.

Related tags

Laravel hybrid-mix
Overview

Hybrid\Mix

Hybrid Mix is a class for working with Lavarel Mix. It adds helper methods for quickly grabbing asset files cached in the mix-manifest.json file.

Requirements

  • WordPress 5.7+.
  • PHP 5.6+ (preferably 7+).
  • Composer for managing PHP dependencies.

Documentation

Create a new instance of the Hybrid\Mix\Mix class, passing in a file path and file URI to your project's public folder.

use Hybrid\Mix\Mix;

$mix = new Mix(
	'public/folder/path',
	'public/folder/uri'
);

Return the cached asset file URI with an appended ID using the asset() method:

// Stylesheet: public/folder/uri/css/style.css?id=xxx
$mix->asset( 'css/style.css' );

// JavaScript: public/folder/uri/js/app.js?id=xxx
$mix->asset( 'js/app.js' );

When using the core WordPress enqueue functions, make sure to set the $ver parameter to null (not false). The id parameter added to the file URL will serve for cache busting.

// Stylesheet.
wp_enqueue_style( $handle, $mix->asset( 'css/style.css' ), $deps, null, $media );

// JavaScript.
wp_enqueue_script( $handle, $mix->asset( 'js/app.js' ), $deps, null, $in_footer );

Copyright and License

This project is licensed under the GNU GPL, version 2 or later.

2021 © Justin Tadlock.

You might also like...
A collection of useful traits for working with PHP 8.1 Enums

A library of helper traits for working with PHP 8.1 enums This package provides a series of traits that allows you to: RestorableFromName Trait Create

An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality.

Support An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality. Ins

A convenient helper for using the laravel-seo package with Filament Admin and Forms
A convenient helper for using the laravel-seo package with Filament Admin and Forms

Combine the power of Laravel SEO and Filament PHP. This package is a convenient helper for using the laravel-seo package with Filament Admin and Forms

Localization Helper - Package for convenient work with Laravel's localization features and fast language files generation
Localization Helper - Package for convenient work with Laravel's localization features and fast language files generation

Localization Helper Package for convenient work with Laravel's localization features and fast language files generation. Installation Via Composer $ c

Laravel Query Helper was developed for laravel 7.2+ to help you optimize sql queries
Laravel Query Helper was developed for laravel 7.2+ to help you optimize sql queries

Laravel Query Helper Laravel Query Helper was developed for laravel 7.2+ to help you optimize sql queries, this package will contain all advanced SQL

SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization).

SEO Helper By ARCANEDEV© SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization). Feel free to check out the rele

Live Helper Chat - live support for your website. Featuring web and mobile apps, Voice & Video & ScreenShare. Supports Telegram, Twilio (whatsapp), Facebook messenger including building a bot.

Live helper chat It's an open-source powered application, which brings simplicity and usability in one place. With live helper chat you can bring live

This package provides new helper functions that take care of handling all the translation hassle and do it for you.

Laravel Translate Message 🥳 This package provides new helper functions that take care of handling all the translation hassle and do it for you. Insta

CSS Exfil helper script to generate injected CSS and corresponding HTML (inspired by mike gualtieri)

The PoC-CSS Exfill Basic Keylogger First of all i was developing bot stuff and i seen attribute=value] [target=_blank] in source code of website. This

Owner
Theme Hybrid
Theme Hybrid
Laravel components for WordPress plugins and themes

Acorn Acorn adds Laravel components to use in your WordPress plugins and themes. Contributing Contributions are welcome from everyone. We have contrib

Roots 494 Jan 7, 2023
Bring multi themes support to your Laravel application with a full-featured Themes Manager

Introduction hexadog/laravel-themes-manager is a Laravel package which was created to let you developing multi-themes Laravel application. Installatio

hexadog 86 Dec 15, 2022
Cache-purge-helper - Additional instances where nginx-helper and lscache plugin should be purged.

cache-purge-helper Additional instances where nginx-helper and lscache plugin should be purged. Install Extract the zip file. Upload them to /wp-conte

Jordan 10 Oct 5, 2022
A helper package to flash a bootstrap alert to the browser via a Facade or a helper function.

Alert Box (Laravel) A helper package to flash a bootstrap alert to the browser via a Facade or a helper function. <div class="alert alert-info fade in

Ben-Piet O'Callaghan 17 Dec 30, 2022
A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class

Changelog Update support for Laravel 6 & phpunit 8 Update composer.json Upgrade to PSR-4 add parameter newline, delimiter, enclosure, and escape to ex

Soapbox Innovations Inc. 249 Nov 29, 2022
View themes is a simple package to provide themed view support to Laravel.

Laravel View Themes View themes is a simple package to provide themed view support to Laravel. Installation Add alexwhitman/view-themes to the require

Alex Whitman 15 Nov 29, 2022
Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).

Laravel-FCM Introduction Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud M

Rahul Thapa 2 Oct 16, 2022
Watch your Laravel app for unwanted changes when working with third-party packages.

Project Secure This package installs a Composer plugin that reports unwanted changes to your Laravel project code after installing or updating a third

The Laravel Hacker 3 Nov 3, 2021
Extend Laravel PHP framework to make working with Aiven databases simpler

Aiven Commands for Laravel ✨ Add some Aiven magic to your Laravel project ✨ This Laravel package provides some aiven commands for artisan to help with

Aiven 8 Aug 19, 2022
Makes working with DateTime fields in Laravel's Nova easier

This package adds a DateTime field with support for a global DateTime format, syntactic sugar for formatting individual DateTime fields and powerful d

wdelfuego 6 Aug 4, 2022