GithubHelp home page GithubHelp logo

log1x / sage-eject-blocks Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 0.0 19 KB

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

Home Page: https://github.com/log1x/sage-eject-blocks

License: MIT License

PHP 100.00%
gutenberg wordpress sage10

sage-eject-blocks's Introduction

Sage Eject Blocks

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.

sage-eject-blocks's People

Contributors

log1x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.