wp-launchpad/bud-assets 问题修复 & 功能扩展

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

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

wp-launchpad/bud-assets

最新稳定版本:v3.1.0

Composer 安装命令:

composer require wp-launchpad/bud-assets

包简介

Bud assets mapper library for Launchpad framework

README 文档

README

A mapper between WordPress and Bud.js assets.

To enqueue a bud.js asset then use the name of the entrypoint to enqueue instead of the URL.

Manipulate script

Unlike vanilla WordPress, this library uses a builder to enqueue and register scripts.

For that you can use the method with_script

Enqueue script

To enqueue a script it is possible with the method enqueue the following way:

$assets
    ->with_script('/app.js')
    ->enqueue();

Register script

To register a script it is possible with the method register the following way:

$assets
    ->with_script('/app.js')
    ->register();

Manipulate style

Unlike vanilla WordPress, this library uses a builder to enqueue and register styles.

For that you can use the method with_style

Enqueue style

To enqueue a style it is possible with the method enqueue the following way:

$assets
    ->with_style('/app.css')
    ->enqueue();

Register style

To register a style it is possible with the method register the following way:

$assets
    ->with_style('/app.css')
    ->register();

Register only on certain conditions

With this library, it is possible to enqueue or register a script or style based on certain conditions.

For that on both builders a method with_query is available:

$assets
    ->with_style('/app.css')
    ->with_query(function (\LaunchpadBudAssets\Builders\AvailabilityQuery $query) {
        $query->with_block('my-block')
        return $query;
    })
    ->enqueue();

The query offers a couple entities the asset can be paired with:

Method Entity
with_block Gutenberg block
with_shortcode Shortcode
with_template Template
with_taxonomy Taxonomy
with_post_type Post type

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-05-15