log1x/sage-eject-blocks

This package is abandoned and no longer maintained. No replacement package was suggested.

Eject Sage 10 editor scripts to a optional lazy-loaded plugin.

Fund package maintenance!
Log1x

Installs: 53

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 2

Forks: 0

Type:package

v1.0.3 2019-12-06 17:17 UTC

This package is auto-updated.

Last update: 2021-03-06 20:06:07 UTC


README

Latest Stable Version Build Status Total Downloads

So what do we have here?

This package is a 4-5 hour, half-assed attempt/proof of concept to devise a strategy to solve the seperation of concerns that Gutenberg has created in the theme development workflow.

Preview

Current Problem

Gutenberg is amazing, but has destroyed the theme workflow with having to separate concerns between theme + Gutenberg package/plugin.

If you code your blocks into your theme and the theme changes, your blocks disappear and you risk losing content. Yikes.

Proposed Solution

This attempts to address that concern by allowing you to eject the block scripts from your theme into a plugin auto-magically on-the-go while still prioritizing loading them from your theme if they exist. Styles still come from your theme and are not included during ejection. Theme goes away? Plugin takes over.

The theme stay themein', the generated plugin functions...if it has too. There are currently no dependencies on Sage 10 or Acorn in the generated plugin, but obviously they are required if you want to use this.

Avoiding conflicts

Conflict avoidence is currently done using wp_script_is() – but I am more than open to other solutions/ideas.

This allows us to maintain our workflow 100% inside of our theme, and as a freelance developer, agency, etc. – take it upon ourselves to do the right thing, and eject our scripts into a plugin whether it be manually, through continuous integration, etc. so down the road, if the site is to change - they aren't screwed, and you don't have to change how you've been doing things for the past XY years.

Uhhh...okay?

The concept and CLI flow may be rough around the edges, but I assure you I can make it prettier and feel nicer if this is an idea that would prove to be fruitful and people actually want it.

Maybe this isn't the right way to look at this? Maybe this is useless? I don't know. That's why I'm putting it out there. You tell me.

No, really. Please stop my suffering immediately if this is useless.

TODO (Maybe?)

  • Make CLI prettier.
  • Allow more verbose output.
  • Allow things to be more programatical (no input required).
  • Allow things to be pre-configured (config/whatever.php).
  • Assure CI flow is adequate (see 3/4).
  • Debate wp_script_is() and alternatives.
  • Debate what should and should not be configurable for compatibility purposes.
  • Assure the plugin loader is written in the best way humanly possible (and works as intended).
  • Some kind of row_action signaling if the plugin is active (scripts loaded) or lazy-loaded.
  • Code check me, please.

Requirements

Installation

Install via Composer:

$ composer require log1x/sage-eject-blocks

Usage

$ wp acorn eject:blocks

Bug Reports

Yes.

Contributing

Yes.

License

Sage Eject Blocks is provided under the MIT License.