Coder Social home page Coder Social logo

bengreeley / wporg-main-2022 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wordpress/wporg-main-2022

0.0 0.0 0.0 1.41 MB

A block-based child theme for WordPress.org, plus local environment

JavaScript 4.38% PHP 88.69% CSS 0.12% HTML 2.62% SCSS 4.19%

wporg-main-2022's Introduction

WordPress.org Block Theme

A block-based child theme for WordPress.org, plus local environment.

Once set up, this environment will contain some shared plugins (Jetpack, Gutenberg, etc), some mu-plugins (wporg-mu-plugins, mu-plugins/pub), and both sets of parent and child themes. The current site uses wporg parent and wporg-main child; while the new design will be done with wporg-parent-2021 and wporg-main-2022 (this repo). The "theme-switcher" in mu-plugins here should control which theme is used, based on the requested page.

Development

Prerequisites

  • Docker
  • Node/npm
  • Yarn
  • Composer

Setup

  1. Set up repo dependencies.

    yarn setup:tools
  2. Start the local environment.

    yarn wp-env start
  3. Run the setup script.

    yarn setup:wp
  4. Build the theme.

    yarn workspaces run build
  5. (optional) There may be times when you want to make changes to the Parent theme and test them with the Main them. To do that:

    1. Clone the Parent repo and follow the setup instructions in its readme.md file.
    2. Create a .wp-env.override.json file in this repo
    3. Copy the themes section from .wp-env.json and paste it into the override file. You must copy the entire section for it to work, because it won't be merged with .wp-env.json.
    4. Update the path to the Parent theme to the Parent theme folder inside the Parent repository you cloned above.
    {
        "themes": [
    	    "./source/wp-content/themes/wporg",
    	    "./source/wp-content/themes/wporg-main",
    	    "./source/wp-content/themes/wporg-main-2022",
    	    "../wporg-parent-2021/source/wp-content/themes/wporg-parent-2021"
        ]
    }
  6. Visit site at localhost:8888.

  7. Log in with username admin and password password.

Environment management

These must be run in the project's root folder, not in theme/plugin subfolders.

  • Stop the environment.

    yarn wp-env stop
  • Restart the environment.

    yarn wp-env start
  • Build the theme's JavaScript

    yarn workspace wporg-main-2022-theme build

    or, automatically build on changes:

    yarn workspace wporg-main-2022-theme start
  • Refresh local WordPress content with a current copy from the staging site.

    yarn setup:refresh
  • Reset WordPress to a clean install, and reconfigure. This will nuke all local WordPress content!

    yarn wp-env clean all
    yarn setup:wp
  • SSH into docker container.

    yarn wp-env run wordpress bash
  • Run wp-cli commands. Keep the wp-cli command in quotes so that the flags are passed correctly.

    yarn wp-env run cli "post list --post_status=publish"
  • Update composer dependencies and sync any repo-tools changes.

    yarn update:tools
  • Run a lighthouse test.

    yarn lighthouse
  • Check visual diffs.

Backstopjs can be manually run to create reference snapshots and then check for visual differences.

```bash
yarn backstop:reference
# change something in the code or content
yarn backstop:test
```

Building Patterns from Page Content

  1. Run the generator script:
    1. If you're using the Docker environment, start Docker and run yarn wp-env start. Then run yarn build:patterns.
    2. If you're using a local environment, cd env and run wp eval-file export-content/index.php page-manifest.json directly.
  2. Verify git stat and git diff look right
  3. git add and git commit
  4. Sync to SVN and deploy like you would any other commit

wporg-main-2022's People

Contributors

ryelle avatar adamwoodnz avatar tellyworth avatar iandunn avatar dd32 avatar stevendufresne avatar renintw avatar coffee2code 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.