Skip to content
pragmatedevPublic

About

No description, website, or topics provided.

Resources

Stars

25 stars

Watchers

6 watching

Forks

Repository files navigation

Initialization

Here are the steps that should be performed when initializing a new WordPress project.

  1. Clone the starter repository: git clone [email protected]:pragmatedev/vilare.git vilare.com
  2. Prepare the local environment:
    1. Create local server with PHP 8.4 and MySQL 8.4.
    2. Create a new database for the project: vilare.com
    3. Assign a new domain to the project with SSL: https://vilare.test
  3. In the terminal, go to the project root and run ./init.sh.

🎥 https://youtu.be/38ppFXgkIRk

Installation

Here are the steps that should be performed when initializing an ongoing WordPress project.

  1. Clone the project repository: git clone [email protected]:pragmatedev/vilare.com.git
  2. Prepare the local environment:
    1. Create local server with PHP 8.4 and MySQL 8.4.
    2. Create a new database for the project: vilare.com
    3. Assign a new domain to the project with SSL: https://vilare.test
  3. In the terminal, go to the project root and run ./init.sh.
  4. Download the wp-content/uploads to your local environment from the remote.

🎥 https://youtu.be/BP8Aw5ZMn1A

Commands

The project uses Vite as a bundler and development server with HMR and Hot Reload features.

  • yarn dev - Starts the development server [🔗].
  • yarn build - Builds theme assets in production mode [🔗] [🔗].
  • yarn lint - Checks codebase for meeting defined coding standards.
  • yarn format - Formats codebase to meet defined coding standards.
  • yarn translate - Generates lang.pot file in the theme resources.
  • yarn vilare - Runs theme CLI tools.

The project uses vilare CLI tool to enhance development operations.

  • yarn vilare --help - Displays help for a CLI tool.
  • yarn vilare database - Manages database operations.
  • yarn vilare component - Manages components operations.
  • yarn vilare test - Manages testing operations.
  • yarn vilare release - Creates production package.
  • yarn vilare deploy - Deploys release package.

🎥 https://youtu.be/1CXuoyRYb98

General

Requirements

Development

  • Single components should be developed on the /playground/ template.
  • Before approaching Pull Requests, Lighthouse tests should be performed using the yarn vilare test psi command, which checks the /playground/ page with component and highlights any issues. Any problems directly related to the component must be addressed before proceeding to the next steps.
  • After approving Pull Requests, the staging server should be updated, and the new block should be added to the /demo/ template that lists all the custom blocks, allowing the team to access them in one place.

Code Review

  • Each feature branch must be merged to develop branch only via the Pull Request.
  • Each Pull Request must meet the following requirements before merging:
    • It must pass the coding standard checks defined in Github Actions / Bitbucket Pipelines.
    • It should include Toggl, Basecamp, Preview links in the description.
    • It should include screenshots from Lighthouse tests performed by yarn vilare test psi command.
      • There should be not not any accessibility issues related to the specific feature.
      • There should be not not any performance issues related to the specific feature.
    • It should have at least one approval from the project leader.
      • Pull requests must be assigned for review only when all the previous requirements are met.
    • After approving pull request by the project leader, developer takes care of the merging process.

Components

The project is created using a component-driven approach. It consists of components, blocks, and templates. Although each of them serve different role they share a similar style.

Component

Components are the smallest units used to build websites supported by Laravel Blade. They are available throughout the website and should include only the most basic functionalities to maintain simplicity.

  • Creation: yarn vilare component create --type=component --id=button
  • Usage: <x-button />

Block

Blocks are larger units integrated with ACF and Gutenberg, used to define the layout of the website. They can include more complex functionalities and utilize granular components. When possible, blocks should use InnerBlocks to provide flexibility for clients and should utilize container queries instead of traditional media queries.

  • Creation: yarn vilare component create --type=block --id=newsletter
  • Usage: {!! block('newsletter')->render(['title' => 'custom title']) !!}

Template

Templates are the largest components. Those defined in the theme are automatically resolved and rendered by WordPress.

  • Creation: yarn vilare component create --type=template --id=article
  • Usage: Choose page template from WordPress admin panel.

Example

  1. Block Structure:
    1. Controller: Used for defining the block schema, default data and any backend mechanisms.
    2. Template: Used for displaying the data that has been defined in the block.
    3. Scripts: Used for defining user interactivity.
    4. Styles: Used for defining visual layer.
    5. ACF Fields: Block fields saved with Local JSON implementing block schema for Gutenberg.
  2. Block Creation
    1. Use the yarn vilare component create --type=block --id=newsletter command in the theme's root. The command will create a new block and automatically load it into the system. You might need to restart your development server.
    2. Define the block schema and fill it with the default values when needed. Block schema uses the Laravel Validation component, but if you're not familiar with this yet, please at least define the simplest typing schema to check if the passed is a string, array, boolean, or required.
    3. Go to the ACF Field Groups, clone the Block: Base group, and adjust to the newly created block while keeping the same naming conventions. The field naming and validation rules should reflect the ones defined in the schema.
  3. Block Rendering
    1. Use the {!! block('newsletter')->render(['title' => 'custom title']) !!} function in Blade templates. To fill the block with values, pass the data array to the render function based on the defined schema.
    2. Choose the block in the Gutenberg and fill with the data.

About

No description, website, or topics provided.

Resources

Stars

25 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages