themehybrid/hybrid-mix 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

themehybrid/hybrid-mix

最新稳定版本:1.0.0

Composer 安装命令:

composer require themehybrid/hybrid-mix

包简介

Hybrid Mix is a helper class for WordPress plugins and themes using Laravel Mix.

关键字:

README 文档

README

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.

统计信息

  • 总下载量: 4.16k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2021-06-28