Giter VIP home page Giter VIP logo

Comments (2)

bobbingwide avatar bobbingwide commented on September 4, 2024

Steps to update the existing bigram/seen-before block

  • Update wp-scripts using npm run packages-update
  • Move the block's src files into separate folder within src/seen-before
  • Move the block.json file into the same folder.
  • Change the block's block.json file to refer to the appropriate entry-point and CSS
  • Update server logic to load the block.json from the build folder
  • Build using npm run dev
  • Test

Not necessary since the block's not internationalized.

  • Call wp_set_script_translations() for each block's editor-script
  • Correct the filter function for load_script_textdomain_relative_path

Steps to add the new bigram/search-banter block

  • Create a new subdirectory src/search-banter
  • Copy and cobble source files from seen-before
  • Add the block registration in bigram_block_block_init
  • Develop the new dynamic block's server side rendering function bigram_block_dynamic_block_search_banter

from bigram.

bobbingwide avatar bobbingwide commented on September 4, 2024

The lastest documentation for wp-scripts implies that it's possible to create multiple entry points automatically

When using the start or build commands, the source code directory ( the default is ./src) and its subdirectories are scanned for the existence of block.json files. If one or more are found, they are treated a entry points and will be output into corresponding folders in the build directory. This allows for the creation of multiple blocks that use a single build process.

See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#automatic-block-json-detection-and-the-source-code-directory

I couldn't get this to work.
No matter what value I entered for editorScript in block.json I got messages from the build and nothing was output.

In the end I used the same solution as for oik, a custom webpack.config.js, but changed the server side registration to use the build folder rather than the src folder.

from bigram.

Related Issues (20)

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.