GithubHelp home page GithubHelp logo

inpsyde / gutenberg-versions-mirror Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 90.47 MB

Package that mirrors and provide multiple versions of the Gutenberg plugin

License: GNU General Public License v2.0

PHP 10.51% JavaScript 89.47% CSS 0.03%
gutenberg-plugin wordpress-plugin

gutenberg-versions-mirror's Introduction

Gutenberg Versions Mirror

What is this?

This package contains a mirror of multiple versions of Gutenberg plugin, in different sub-folders. This allows to contemporarily deploy multiple versions of Gutenberg to WordPress, and let different themes (for example) require different versions.

How does it work?

The wp.org API is called regularly in a GitHub Action to find new Gutenberg versions.

If new versions are found, they are saved, each in a separate folder.

A utility class shipped with the package allows external code to require Gutenberg in the desired version.

How to use this package

  • Require via Composer.
  • Ensure Composer autoload is loaded.
  • From a MU plugin require the version you need in one of the following ways

Require a specific version

/** @var string|null $loadedVersion The exact version loaded or null on failure */
$loadedVersion = Inpsyde\GutenbergVersions\Loader::loadVersion('14.1.0');

Require the first found among a list of possible (accepted) versions

/** @var string|null $loadedVersion The exact version loaded or null on failure */
$loadedVersion = Inpsyde\GutenbergVersions\Loader::loadVersion('14.1.0', '13.2.0');

Require via Semver requirement

/** @var string|null $loadedVersion The exact version loaded or null on failure */
$loadedVersion = Inpsyde\GutenbergVersions\Loader::loadMatching('^14');

$loadedVersion = Inpsyde\GutenbergVersions\Loader::loadMatching('>=14.2.0 || ~13.2');

URL filtering

Gutenberg internally calls plugins_url() with the assumption it is installed under the plugins' folder.

However, when using this library, Gutenberg files are deeper in the plugin folder tree.

To fix broken URLs resulting from that, when loading a Gutenberg version, the package also filters plugins_url().

Unique loading

The package ensures that any attempt of loading Gutenberg multiple times (same of different version) will fail.

License

This repository is a free software, and is released under the terms of the GNU General Public License version 2 or (at your option) any later version. See LICENSE for complete license.

gutenberg-versions-mirror's People

Contributors

chrico avatar gmazzap avatar inpsyde-deploybot avatar retrorism avatar widoz avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.