Coder Social home page Coder Social logo

bubs-next's Introduction

This is the starter Headless WordPress + Next.js used to build sites by Patronage. We've previously built nearly a hunred sites using our original theme based bubs scaffolding, but are favoring headless WordPress now (link to case study to come).

To get up and running locally:

  1. Setup Wordpress by going into the wordpress folder and running composer install && yarn install. Then you can use yarn dev as an alias to start docker.
  2. Setup Next by going into the wordpress folder and pulling down env variables by running vercel env pull (see 'configuring vercel' if first time). Then run vercel dev to preview the site locally.

Configuring vercel

Vercel is the host for the site. It integrates with github to create preview versions from pull requests, and to deploy on master.

If it's your first time getting setup, you'll need to first accept an invite to the Patronage team for the project.

Then you'll need to install/configure the vercel cli:

  1. `npm install -g vercel
  2. vercel login to login

After that, the first time you run a command, you'll need to pick a project via vercel link. Make sure you're using the team account from the cli to do that.

Prettier/stylelint

We have prettier and styleling configured to format JS and SCSS respectively for consistency across developers.

Prettier will run via husky pre-commit, and there is a command line yarn stylelint to see SCSS warnings across the project. But it's best to configure your editor with the plugins so that they run in the background on save.

Env for local overrides

When you run vercel env pull, it'll save keys to a gitignored .env file. These are not neccessarily the production or preview environment keys, but once specifically saved for devs.

Any variable can be optionally ovveridden in a .env.local. Here is an example you might use:

## Set a wordpress localhost path if you want to load from local
#WORDPRESS_API_URL="http://www.bailouts.loc/graphql"

WordPress theme notes

All plugins are managed via composer. The headless theme is configured to make some light adjustments to WordPress to support headless dev.

In themes/headless/functions.php there is a $headless_domainvariable that should be defined for each site. This variable is used to redirect the user whenever they try and access a page URL from WordPress admin.

If this is your first time with docker, there are more instructions for getting that running in wordpress/README.md.

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.