Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/htmlburger/wpemerge-theme

An organized, ES6 and SASS powered theme taking advantage of the WP Emerge framework. ๐Ÿš€
https://github.com/htmlburger/wpemerge-theme

blade php starter-theme wordpress wp-emerge-theme wpemerge

Last synced: about 1 month ago
JSON representation

An organized, ES6 and SASS powered theme taking advantage of the WP Emerge framework. ๐Ÿš€

Awesome Lists containing this project

README

        

# WP Emerge Starter Theme Logo

[![Packagist](https://img.shields.io/packagist/vpre/htmlburger/wpemerge-theme.svg?style=flat-square&colorB=0366d6)](https://packagist.org/packages/htmlburger/wpemerge-theme) [![Build](https://img.shields.io/github/workflow/status/htmlburger/wpemerge-theme/Tests?style=flat-square)](https://github.com/htmlburger/wpemerge-theme/actions/workflows/test.yml) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square&colorB=7d07d1)](https://gitter.im/wpemerge/Lobby)

A modern WordPress starter theme which uses the [WP Emerge](https://github.com/htmlburger/wpemerge) framework.

_This is the WP Emerge Starter Theme project - for the WP Emerge framework please check out https://github.com/htmlburger/wpemerge._

## Summary

- [Documentation](#documentation)
- [Development Team](#development-team)
- [Comparison Table](#comparison-table)
- [Features](#features)
- [Non-goals](#non-goals)
- [Requirements](#requirements)
- [Directory structure](#directory-structure)
- [Contributing](#contributing)

## Documentation

[http://docs.wpemerge.com/#/starter/theme/overview](http://docs.wpemerge.com/#/starter/theme/overview)

[http://docs.wpemerge.com/#/starter/theme/quickstart](http://docs.wpemerge.com/#/starter/theme/quickstart)

## Development Team

Brought to you by [Atanas Angelov](https://atanas.dev/) and the lovely folks at [htmlBurger](http://htmlburger.com).

## Comparison Table

| | WP Emerge Theme | Sage | Timber |
|--------------------------------|------------------|----------------|----------|
| View Engine | PHP, Blade, Twig, any | PHP, Blade | Twig |
| Routing | โœ” | โœ– | โœ” |
| WP Admin Routing | โœ” | โœ– | โœ– |
| WP AJAX Routing | โœ” | โœ– | โœ– |
| MVC | โœ–โœ”โœ” | โœ–โœ”โœ–ยน | โœ–โœ”โœ– |
| Middleware | โœ” | โœ– | โœ– |
| View Composers | โœ” | โœ”/โœ–ยฒ | โœ– |
| Service Container | โœ” | โœ” | โœ– |
| Stylesheets | SASS + PostCSS | SASS + PostCSS | N/Aยณ |
| JavaScript | ES6 | ES6 | N/Aยณ |
| Front end, Admin, Editor and Login Bundles | โœ”โœ”โœ”โœ” | โœ”โœ–โœ–โœ– | N/Aยณ |
| Automatic Sprite Generation | โœ” | โœ– | N/Aยณ |
| Automatic Cache Busting | โœ” | โœ– | โœ– |
| WPCS Linting | โœ” | โœ– | โœ– |
| [Advanced Error Reporting](https://docs.wpemerge.com/#/framework/routing/error-handling) | โœ” | โœ– | โœ– |
| WP Unit Tests for your classes | โœ” | โœ– | โœ– |

_ยน Sage's Controller is more of a View Composer than a Controller._

_ยฒ Sage's Controller provides similar functionality but is limited to 1 composer (controller) per view and vice versa._

_ยณ Timber does not provide a front-end build process so you can implement whatever you prefer._

_Email any factual inaccuracies to [[email protected]](mailto:[email protected]) so they can be corrected._

## Features
- All features from [WP Emerge](https://docs.wpemerge.com/#/framework/overview):
- Named routes with custom URLs and query filters
- Controllers
- Middleware
- PSR-7 Responses
- View Composers
- Service Container
- Service Providers
- PHP view layouts (a.k.a. automatic wrapping)
- Support for PHP, [Blade 5.4](https://laravel.com/docs/5.4/blade) and/or [Twig 2](https://twig.symfony.com/doc/2.x/api.html) for views
- Gutenberg support.
- [SASS](https://sass-lang.com/) + [PostCSS](https://github.com/postcss/postcss) for stylesheets. Separate bundles are created for **front-end**, **administration**, **Gutenberg** and **login** pages and custom bundles can be added easily.
- ES6 for JavaScript. Separate bundles are created for **front-end**, **administration**, **Gutenberg** and **login** pages and custom bundles can be added easily.
- Pure [Webpack](https://webpack.js.org/) to transpile and bundle assets, create sprites, optimize images etc.
- [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/) for synchronized browser development.
- Autoloading for all classes in your `MyApp\` namespace.
- Automatic, fool-proof cache busting for all assets, including ones referenced in styles.
- WPCS, JavaScript and SASS linting and fixing using a single yarn command.
- Single-command optional CSS package installation:
- Normalize.css
- Boostrap 4
- Bulma
- Foundation
- Tachyons
- Tailwind CSS
- Spectre.css
- FontAwesome
- WP Unit Test scaffolding for your own classes.

## Non-goals

- Taking over the WordPress main query.

WP Emerge does __not__ take over the main query - it actively works with it.
- Taking over WordPress routing.

WP Emerge does __not__ take over WordPress' routing - it actively works with it. The only exception to this are hardcoded URLs explicitly added by a user.
- Reinventing WordPress APIs using object-oriented interfaces.

WP Emerge does not provide alternative APIs for registering post types, taxonomies or the like for little added benefit. Instead, it provides logical and handy places for developers to use core APIs.
- Using a third party engine by default.

WP Emerge uses PHP by default in the same way WordPress does but with added features. Using a third party engine is entirely optional and requires installing an extension.
- Include most of Laravel or another framework.

WP Emerge is lean and tuned for WordPress. While inspired by Laravel, it does not come with any `illuminate/*` packages. There are only 2 third party production dependencies:
- `pimple/pimple` - The single-file PHP service container.
- `guzzlehttp/psr7` - A PSR-7 Request and ServerRequest implementation.

## Requirements

- [PHP](http://php.net/) >= 5.5
- [WordPress](https://wordpress.org/) >= 4.7
- [Composer](https://getcomposer.org/)
- [Node.js](https://nodejs.org/en/) >= 12
- [Yarn](https://yarnpkg.com/en/) or NPM

## Directory structure

```
wp-content/themes/your-theme
โ”œโ”€โ”€ app/
โ”‚ โ”œโ”€โ”€ helpers/ # Helper files, add your own here as well.
โ”‚ โ”œโ”€โ”€ routes/ # Register your WP Emerge routes.
โ”‚ โ”‚ โ”œโ”€โ”€ admin.php
โ”‚ โ”‚ โ”œโ”€โ”€ ajax.php
โ”‚ โ”‚ โ””โ”€โ”€ web.php
โ”‚ โ”œโ”€โ”€ src/ # PSR-4 autoloaded classes.
โ”‚ โ”‚ โ”œโ”€โ”€ Controllers/ # Controller classes for WP Emerge routes.
โ”‚ โ”‚ โ”œโ”€โ”€ Routing/ # Register your custom routing conditions etc.
โ”‚ โ”‚ โ”œโ”€โ”€ View/ # Register your view composers, globals etc.
โ”‚ โ”‚ โ”œโ”€โ”€ WordPress/ # Register post types, taxonomies, menus etc.
โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”œโ”€โ”€ config.php # WP Emerge configuration.
โ”‚ โ”œโ”€โ”€ helpers.php # Require your helper files here.
โ”‚ โ”œโ”€โ”€ hooks.php # Register your actions and filters here.
โ”‚ โ””โ”€โ”€ version.php # WP Emerge version handling.
โ”œโ”€โ”€ dist/ # Bundles, optimized images etc.
โ”œโ”€โ”€ languages/ # Language files.
โ”œโ”€โ”€ resources/
โ”‚ โ”œโ”€โ”€ build/ # Build process configuration.
โ”‚ โ”œโ”€โ”€ fonts/
โ”‚ โ”œโ”€โ”€ images/
โ”‚ โ”œโ”€โ”€ scripts/
โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Administration scripts.
โ”‚ โ”‚ โ”œโ”€โ”€ editor/ # Gutenberg editor scripts.
โ”‚ โ”‚ โ”œโ”€โ”€ login/ # Login scripts.
โ”‚ โ”‚ โ””โ”€โ”€ frontend/ # Front-end scripts.
โ”‚ โ”œโ”€โ”€ styles/
โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Administration styles.
โ”‚ โ”‚ โ”œโ”€โ”€ editor/ # Gutenberg editor styles.
โ”‚ โ”‚ โ”œโ”€โ”€ login/ # Login styles.
โ”‚ โ”‚ โ”œโ”€โ”€ frontend/ # Front-end styles.
โ”‚ โ”‚ โ””โ”€โ”€ shared/ # Shared styles.
โ”‚ โ””โ”€โ”€ vendor/ # Any third-party, non-npm assets.
โ”œโ”€โ”€ vendor/ # Composer packages.
โ”œโ”€โ”€ views/
โ”‚ โ”œโ”€โ”€ layouts/
โ”‚ โ””โ”€โ”€ partials/
โ”œโ”€โ”€ views-alternatives/ # Views for other engines like Blade.
โ”œโ”€โ”€ functions.php # Bootstrap theme.
โ”œโ”€โ”€ screenshot.png # Theme screenshot.
โ”œโ”€โ”€ style.css # Theme stylesheet.
โ”œโ”€โ”€ wpemerge # WP Emerge CLI shortcut.
โ””โ”€โ”€ ...
```

### Notable directories

#### `app/helpers/`

Add PHP helper files here. Helper files should include __function definitions only__. See below for information on where to put actions, filters, classes etc.

#### `app/src/`

Add PHP class files here. All clases in the `MyApp\` namespace are autoloaded in accordance with [PSR-4](http://www.php-fig.org/psr/psr-4/).

#### `resources/images/`

Add images for styling here. Optimized copies will be placed in `dist/images/` when running the build process.

#### `resources/styles/frontend/`

Add .css and .scss files to add them to the front-end bundle. Don't forget to `@import` them in `index.scss`.

#### `resources/styles/[admin,editor,login]/`

These directories are for the admin, editor and login bundles, respectively. They work identically to the main `resources/styles/frontend/` directory.

#### `resources/scripts/frontend/`

Add JavaScript files here to add them to the frontend bundle. The entry point is `index.js`.

#### `resources/scripts/[admin,editor,login]/`

These directories are for the admin, editor and login bundles, respectively. They work identically to the main `resources/scripts/frontend/` directory.

#### `views/`

While views that follow the WordPress template hierarchy should go in the theme root directory (e.g. `index.php`, `searchform.php`, `archive-post.php` etc.), others should go in the following directories:
1. `views/layouts/` - Layouts that other views extend.
2. `views/partials/` - Small snippets that are meant to be reused throughout other views.
3. `views/` - Named [custom post templates](https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use) or views that don't fit anywhere else.

Avoid adding any PHP logic in any of these views, unless it pertains to layouting. Business logic should go into:
- Helper files (`app/helpers/*.php`)
- Service classes
- [WP Emerge Controllers](https://docs.wpemerge.com/#/framework/routing/controllers)

## Contributing

WP Emerge Starter Theme is completely open source and we encourage everybody to participate by:

- Reviewing `.github/CONTRIBUTING.md`.
- โญ the project on GitHub \([https://github.com/htmlburger/wpemerge-theme](https://github.com/htmlburger/wpemerge-theme)\)
- Posting bug reports \([https://github.com/htmlburger/wpemerge-theme/issues](https://github.com/htmlburger/wpemerge-theme/issues)\)
- (Emailing security issues to [[email protected]](mailto:[email protected]) instead)
- Posting feature suggestions \([https://github.com/htmlburger/wpemerge-theme/issues](https://github.com/htmlburger/wpemerge-theme/issues)\)
- Posting and/or answering questions \([https://github.com/htmlburger/wpemerge-theme/issues](https://github.com/htmlburger/wpemerge-theme/issues)\)
- Submitting pull requests \([https://github.com/htmlburger/wpemerge-theme/pulls](https://github.com/htmlburger/wpemerge-theme/pulls)\)
- Sharing your excitement about WP Emerge with your community