Download the PHP package humanmade/extended-block-variations without Composer

On this page you can find all versions of the php package humanmade/extended-block-variations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package extended-block-variations

Extended Block Variations

Extends WordPress theme.json block style variations with custom properties for external stylesheets.

Overview

WordPress supports defining block style variations in theme.json partials located in the /styles/ directory. However, the native implementation doesn't support linking external CSS files to style variations, either by style_handle or by file: reference.

This plugin adds support for this feature through a custom property in your theme.json variation files.

Usage

Custom Property

Add this custom property to your block style variation JSON files in themes/your-theme/styles/.../*.json:

stylesheet (string)

Path to an external stylesheet or a registered style handle.

Example

File: themes/your-theme/styles/blocks/button/primary.json

File: themes/your-theme/styles/blocks/button/primary-button.css

File Path Resolution

File paths are resolved relative to the JSON file's directory:

Use ../ to reference parent directories:

Using Pre-registered Handles

If you've already registered a style handle via wp_register_style(), reference it directly:

Versioning stylesheets

WordPress normally sets block asset versions based on the version string in block.json. Since the schema for block style variation JSON partials does not include a version number, you can manually specify a version string in your stylesheet reference:

If you omit the ver parameter, a version string will be computed by hashing the stylesheet. This requires an inefficient full-file read operation on every registration call, so this auto-versioning should only be used as a fallback convenience while actively developing styles.

How It Works

  1. WordPress core reads theme.json partials from /styles/ and registers block style variations
  2. This plugin scans the same directory for JSON files containing a stylesheet property
  3. For file: references:
    • The path is resolved relative to the JSON file's location
    • A unique style handle is generated based on the file path
    • The stylesheet is registered with WordPress (including RTL support and path data for inlining)
  4. Stylesheets are enqueued via wp_enqueue_block_style():
    • If block assets load on-demand: Enqueued when blocks with the variation class render
    • Otherwise: Enqueued immediately
  5. WordPress handles merging the styles with theme.json definitions and potential inlining

Compatibility

This plugin extends core WordPress functionality and follows the same file structure conventions as WordPress core's theme.json parser.

API Reference

Extended_Block_Variations\register_variation_stylesheets(): void

Enqueues stylesheets for block style variations that define a custom stylesheet property. Handles both immediate and on-demand loading based on theme configuration.

Performance Optimizations

The plugin integrates with WordPress's block asset loading strategies:

Integration with Theme

WordPress core automatically registers block style variations from theme.json partials in the /styles/ directory. This plugin enhances that process by:

  1. Detecting variations with custom stylesheet properties
  2. Resolving and registering the referenced stylesheets
  3. Enqueueing them alongside the core-registered block styles

The plugin hooks into after_setup_theme, running before block registration to ensure stylesheets are ready when blocks render. No additional configuration is required - simply add the stylesheet property to your variation JSON files.

Setting Default Block Styles

To configure default block styling, use theme.json to set styles at the block level rather than the variation level. This is the WordPress-native approach and ensures proper inheritance and overrides.


All versions of extended-block-variations with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package humanmade/extended-block-variations contains the following files

Loading the files please wait ...