Skip to content

Commit

Permalink
Add handler for non-JS assets (resolve #31) (#34)
Browse files Browse the repository at this point in the history
* Add Gulp task for plugin readme
* Add Gulp task for CSS
  • Loading branch information
Ned Zimmerman authored Jun 6, 2019
1 parent 4b6735e commit 1953564
Show file tree
Hide file tree
Showing 14 changed files with 1,951 additions and 448 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog #
## 0.7.0 ##
* Add fields for image and video attribution (#32): #33
* Add Gulp tasks for CSS build and readme to Markdown (#31): #34

## 0.6.0 ##
* Rename plugin: #16
* Add configuration for automatic deployment: #18
* Update dependencies: #21, #22, #23, #25, #26
* Add metadata fields and taxonomies to people (#27): #28
* Unregister unnecessary blocks: #29
* Add descriptions to event fields (#14): #30

## 0.5.0 ##
* Add thumbnail support to events and people: #13

## 0.4.0 ##
* Configure CI (resolve #10)
* Change event slug

## 0.3.2 ##
* Update license

## 0.3.1 ##
* Normalize composer.json
* Clean up package.json

## 0.3.0 ##
* Remove unused post types
* Make events hierarchical
* Refine event metadata, add experimental event meta block (unused)

## 0.2.0 ##
* Rebuild dynamic blocks in JavaScript
* Register custom fields using CMB2 instead of ACF

## 0.1.0 ##
* Add dynamic blocks using ACF Blocks utility
* Scaffold initial post types
2 changes: 2 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Frequently Asked Questions #
None yet.
56 changes: 0 additions & 56 deletions Gruntfile.js

This file was deleted.

66 changes: 16 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,34 @@
# PCC Framework #
**Contributors:** [greatislander](https://profiles.wordpress.org/greatislander)
**Tags:** blocks, custom post types
**License:** BSD 3-Clause "New" License
**License URI:** https://opensource.org/licenses/BSD-3-Clause
**Requires at least:** 5.2.1
**Tested up to:** 5.2.1
**Stable tag:** 0.6.0

Utilities, custom post types and blocks for the Platform Cooperativism Consortium website.

## Description ##

Utilities, custom post types and blocks for the Platform Cooperativism Consortium website.

## Installation ##

1. Upload the plugin zip file via the Plugins panel in WordPress.
2. Activate the plugin.
3. There is no step three.
Utilities, blocks, custom post types, and taxonomies for the Platform Cooperativism Consortium website.

## Frequently Asked Questions ##
## Description ##

None yet.
This plugin adds the following custom components for the Platform Cooperativism Consortium:

## Changelog ##
### 0.7.0 ###
* Add fields for image and video attribution (#32): #33
Blocks:

### 0.6.0 ###
* Rename plugin: #16
* Add configuration for automatic deployment: #18
* Update dependencies: #21, #22, #23, #25, #26
* Add metadata fields and taxonomies to people (#27): #28
* Unregister unnecessary blocks: #29
* Add descriptions to event fields (#14): #30
* Child Pages
* Social Links

### 0.5.0 ###
* Add thumbnail support to events and people: #13
Custom Post Types:

### 0.4.0 ###
* Configure CI (resolve #10)
* Change event slug
* Events
* People

### 0.3.2 ###
* Update license
Custom Taxonomies:

### 0.3.1 ###
* Normalize composer.json
* Clean up package.json
* Roles
* Topics

### 0.3.0 ###
* Remove unused post types
* Make events hierarchical
* Refine event metadata, add experimental event meta block (unused)
## Installation ##

### 0.2.0 ###
* Rebuild dynamic blocks in JavaScript
* Register custom fields using CMB2 instead of ACF
1. Upload the plugin zip file via the Plugins panel in WordPress.
2. Activate the plugin.
3. There is no step three.

### 0.1.0 ###
* Add dynamic blocks using ACF Blocks utility
* Scaffold initial post types

## Upgrade Notice ##

### 0.6.0 ###
The plugin has been renamed to pcc-framework. Removing and reinstalling is recommended.
1 change: 1 addition & 0 deletions build/admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { src, dest, parallel } = require( 'gulp' );
const autoprefixer = require( 'autoprefixer' );
const cssnano = require( 'cssnano' );
const postcss = require( 'gulp-postcss' );
const readme = require( 'gulp-readme-to-markdown' );

function css() {
const plugins = [
autoprefixer(),
cssnano(),
];
return src( './src/*.css' )
.pipe( postcss( plugins ) )
.pipe( dest( './build' ) );
}

function readmeToMarkdown() {
return src( [ 'readme.txt' ] )
.pipe( readme( {
details: false,
screenshot_ext: [ 'jpg', 'jpg', 'png' ],
extract: {
changelog: 'CHANGELOG',
'Frequently Asked Questions': 'FAQ',
},
} ) )
.pipe( dest( '.' ) );
}

exports.css = css;
exports.readme = readmeToMarkdown;
exports.default = parallel( css );
8 changes: 6 additions & 2 deletions lib/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

function enqueue_assets()
{
// TODO: Build to /build directory
wp_enqueue_style('platformcoop-support', plugin_dir_url(dirname(__FILE__)) . '/src/admin.css', false, null);
wp_enqueue_style(
'platformcoop-support',
plugin_dir_url(dirname(__FILE__)) . '/build/admin.css',
false,
PCC_FRAMEWORK_VERSION
);
}
2 changes: 1 addition & 1 deletion lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function register_block_assets()
'wp-blocks',
'wp-components'
],
false,
PCC_FRAMEWORK_VERSION,
true
);
}
10 changes: 10 additions & 0 deletions lib/posttypes/pcc-person.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ function get_people()
return $options;
}

/**
* Registers meta fields for the `pcc-person` post type.
*
* @return null
*/
function register_meta()
{
// TODO.
}

/**
* Registers the Person Data metabox and meta fields.
*
Expand Down
4 changes: 4 additions & 0 deletions lib/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

namespace PCCFramework\Utils;

if (! defined('PCC_FRAMEWORK_VERSION')) {
define('PCC_FRAMEWORK_VERSION', '0.7.0');
}

/**
* Wrapper function around cmb2_get_option
*
Expand Down
18 changes: 13 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@
"devDependencies": {
"@wordpress/eslint-plugin": "^2.2.0",
"@wordpress/scripts": "^3.2.1",
"grunt": "~1.0.4",
"grunt-wp-i18n": "~1.0.3",
"grunt-wp-readme-to-markdown": "~2.0.1"
"autoprefixer": "^9.6.0",
"cssnano": "^4.1.10",
"gulp": "^4.0.2",
"gulp-postcss": "^8.0.0",
"gulp-readme-to-markdown": "^0.2.1"
},
"scripts": {
"readme": "grunt readme",
"readme": "gulp readme",
"start": "wp-scripts start",
"build": "wp-scripts build",
"build": "npm run -s build:js && npm run -s build:css",
"build:js": "wp-scripts build",
"build:css": "gulp css",
"lint:js": "wp-scripts lint-js ./src",
"lint:css": "wp-scripts lint-style './src/**/*.css'",
"lint:pkg-json": "wp-scripts lint-pkg-json .",
"test": "npm run -s lint:js && npm run -s lint:css && npm run -s lint:pkg-json"
},
"browserslist": [
"last 1 version",
"> 1%"
],
"npmPackageJsonLintConfig": {
"extends": "@wordpress/npm-package-json-lint-config",
"rules": {
Expand Down
25 changes: 22 additions & 3 deletions pcc-framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@
* Domain Path: /languages
* License: BSD 3-Clause "New" License
* License URI: https://opensource.org/licenses/BSD-3-Clause
* Version: 0.6.0
* Version: 0.7.0
*
* @package PCCFramework
*/

if (!defined('ABSPATH')) {
die('Direct access to this file is not permitted.');
}

/**
* Load utilities.
*/
require_once dirname(__FILE__) . '/lib/utils.php';

/**
* Ensure dependencies are loaded
* Ensure Composer dependencies are present.
*/
if (!function_exists('register_extended_post_type')) {
if (!file_exists($composer = __DIR__.'/vendor/autoload.php')) {
Expand All @@ -32,6 +39,9 @@
require_once $composer;
}

/**
* Load and register post types.
*/
foreach ([
'attachment',
'event',
Expand All @@ -40,9 +50,13 @@
require_once dirname(__FILE__) . "/lib/posttypes/pcc-$posttype.php";
if ($posttype !== 'attachment') {
add_action('init', '\\PCCFramework\\PostTypes\\' . ucfirst($posttype) . '\\init');
add_action('init', '\\PCCFramework\\PostTypes\\' . ucfirst($posttype) . '\\register_meta');
}
}

/**
* Load and register taxonomies.
*/
foreach ([
'role',
'topic',
Expand All @@ -51,9 +65,11 @@
add_action('init', '\\PCCFramework\\Taxonomies\\' . ucfirst($taxonomy) . '\\init');
}

/**
* Load blocks.
*/
require_once dirname(__FILE__) . '/lib/blocks.php';

add_action('init', '\\PCCFramework\\PostTypes\\Event\\register_meta');
add_action('init', '\\PCCFramework\\Blocks\\register_block_assets');

foreach ([
Expand All @@ -67,6 +83,9 @@
add_action('init', "\\PCCFramework\\Blocks\\$block\\register_block");
}

/**
* Load admin assets and metadata fields.
*/
if (is_admin()) {
require_once dirname(__FILE__) . '/lib/admin.php';
require_once dirname(__FILE__) . '/lib/settings.php';
Expand Down
Loading

0 comments on commit 1953564

Please sign in to comment.