Skip to content

Commit

Permalink
Merge pull request #54 from dreamsicle-io/release/3.1.3
Browse files Browse the repository at this point in the history
Release/3.1.3
  • Loading branch information
theenoahmason authored Mar 7, 2024
2 parents 3baa955 + fb5aca4 commit 132b3dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# WP Theme Assets

A simple, zero configuration [Gulp](https://gulpjs.com) build & lint setup for developing modern [WordPress](https://wordpress.org) themes.
A simple, zero configuration [Gulp](https://gulpjs.com) build & setup for developing modern [WordPress](https://wordpress.org) themes.

This package contains a task runner built entirely on Gulp 4, and will lint `.php` according to the WordPress coding standards, build and optimize `.js`, `.scss` assets, generate a `.pot` language localization file, and optimize images. This package will also create the required `style.css` file and its formatted header comment, as well as the required, [theme directory](https://wordpress.org/themes) friendly `README.md` file with all it's content. This package also comes bundled with utilities to automatically fix code issues, GitHub actions for automatically building release assets and creating releases, and contains recommended extensions and settings for the [VSCode](https://code.visualstudio.com/) IDE.
This package contains a task runner built entirely on Gulp 4, and will build and optimize `.js`, `.scss` assets, generate a `.pot` language localization file, and optimize images. This package will also create the required `style.css` file and its formatted header comment, as well as the required, [theme directory](https://wordpress.org/themes) friendly `README.md` file with all it's content. This package also comes bundled with utilities to automatically fix code issues, GitHub actions for automatically building release assets and creating releases, and contains recommended extensions and settings for the [VSCode](https://code.visualstudio.com/) IDE.

Finally, this package also includes a `WP_Theme_Assets` [php class](https://github.com/dreamsicle-io/wp-theme-assets/blob/master/package/includes/class-wp-theme-assets.php), located in `includes/class-wp-theme-assets.php`. This class beautifully handles all script and stylesheet enqueues of built assets automatically.
This package comes with just the right amount of boilerplate and templating. Included is also a `WP_Theme_Assets` [php class](https://github.com/dreamsicle-io/wp-theme-assets/blob/master/package/includes/class-wp-theme-assets.php), located in `includes/class-wp-theme-assets.php`. This class beautifully handles all script and stylesheet enqueues of built assets automatically.

## Getting Started

Expand Down Expand Up @@ -50,6 +50,14 @@ npm start

The included [gulpfile](https://github.com/dreamsicle-io/wp-theme-assets/blob/master/package/gulpfile.js) contains all tasks that handle linting and building this package.

### Set Node Version

Uses `nvm` to set the node version as defined in the `.nvmrc` file.

```shell
nvm use
```

### Install

Install all `npm` and `composer` dependencies.
Expand All @@ -74,22 +82,6 @@ Run a production build.
npm run build
```

### Lint

Find and report code errors and issues.

```shell
npm run lint
```

### Fix

Correct all fixable code issues.

```shell
npm run fix
```

### Clean

Clean all built files.
Expand All @@ -98,7 +90,7 @@ Clean all built files.
npm run clean
```

## File structure
## Build File Structure

This gulp setup expects that the project root's `package.json` is setup properly, and that an [opinionated file structure](https://github.com/dreamsicle-io/wp-theme-assets/tree/master/package) is followed. The localization tasks are handled by the built in WordPress localization functions in all theme `.php` files, but the [source assets](https://github.com/dreamsicle-io/wp-theme-assets/tree/master/package/assets) should be structured accordingly.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-theme-assets",
"version": "3.1.2",
"version": "3.1.3",
"description": "WP Theme Assets",
"repository": {
"type": "git",
Expand Down
9 changes: 4 additions & 5 deletions package/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use-strict';

import babel from 'babelify';
import browserify from 'browserify';
import esmify from 'esmify';
import del from 'del';
import fs from 'fs';
import gulp from 'gulp';
Expand All @@ -10,7 +9,7 @@ import cached from 'gulp-cached';
import concat from 'gulp-concat';
import debug from 'gulp-debug';
import gulpIf from 'gulp-if';
import imagemin from 'gulp-imagemin';
import imagemin, { svgo } from 'gulp-imagemin';
import order from 'gulp-order';
import rename from 'gulp-rename';
import gulpSass from 'gulp-sass';
Expand Down Expand Up @@ -112,7 +111,7 @@ gulp.task('build:js', function jsBuilder() {
*/
gulp.task('build:pot', function potBuilder() {
const pkg = JSON.parse(fs.readFileSync('./package.json').toString());
return gulp.src(['./**/*.php', '!./+(vendor|node_modules|assets|languages)/**'])
return gulp.src(['./**/*.php', '!./+(.vscode|.github|vendor|node_modules|assets|languages)/**'])
.pipe(gulpWPpot({ domain: pkg.name })
.on('error', function (err) { console.error(err); this.emit('end'); }))
.pipe(cached('build:pot'))
Expand Down Expand Up @@ -335,7 +334,7 @@ gulp.task('build', gulp.series('clean', 'build:assets', 'zip'));
*/
gulp.task('watch', function watcher() {
gulp.watch(['./package.json', './assets/src/md/+(DESCRIPTION|FAQ|COPYRIGHT|CHANGELOG).md'], gulp.series('build:package'));
gulp.watch(['./**/*.php', '!./+(.vscode|vendor|node_modules|assets|languages)/**'], gulp.series('build:pot'));
gulp.watch(['./**/*.php', '!./+(.vscode|.github|vendor|node_modules|assets|languages)/**'], gulp.series('build:pot'));
gulp.watch(['./assets/src/sass/**/*.s+(a|c)ss'], gulp.series('build:sass'));
gulp.watch(['./assets/src/js/**/*.js'], gulp.series('build:js'));
gulp.watch(['./assets/src/images/**/*.+(jpg|jpeg|png|svg|gif)'], gulp.series('build:images'));
Expand Down

0 comments on commit 132b3dc

Please sign in to comment.