Skip to content

eavonius/pugpages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

pugpages

Pugpages is a simple framework for using a pattern in wordpress websites similar to ASP.NET Razor Pages, but using open source php technologies.

Models are created using Timber.

Views are created using phug which is a derivative of the pug markup language originally created for use with JavaScript - adapted for php.

Getting Started

Pugpages was used with a wordpress site created with roots bedrock, though it may be used in any wordpress website with adaptation.

Your site must be using a custom wordpress theme into which you can add code that works with pugpages.

Installation

  1. Add the main branch of pugpages to the repositories section of your composer.json file:

    "repositories": [
      // Other repositories may be included earlier etc...
      {
        "type": "git",
        "url": "https://github.com/eavonius/pugpages"
      }
    ],
  2. Add pugpages/wordpress to your dependencies under the require section of your composer.json file:

    "require": {
      // Other dependencies may be included earlier etc...
      "pugpages/wordpress": "dev-main"
    }
  3. Use composer to update your dependencies:

    composer update
  4. In the root directory of your site's theme, edit your functions.php file and add the line:

    \PugPages\PageLoader::hook(
        get_stylesheet_directory(),
        in_array(env('WP_ENV'), ['staging', 'production'])
    );

    NOTE: This "hooks" pugpages into your theme. The staging and production check turns off pug optimizations unless you're running in a staging or production environment so things refresh faster during development.

  5. Create a pages subdirectory of your site's theme. This is where you'll put source code for pug vies and their corresponding page model files.

Use

TODO

About

A simple model-viewmodel framework for creating wordpress themes using pug and php.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages