Skip to content

Commit

Permalink
1.0.0 update README, new package
Browse files Browse the repository at this point in the history
  • Loading branch information
kellymears committed Jan 8, 2020
1 parent 1c10d15 commit 390cd8d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.0 January 8th, 2020

- Publishing as an org scoped package on npm.
- Update README

## 0.2.0 July 10th, 2019

### Changed
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# Laravel Mix WP Blocks

[![Maintainability](https://api.codeclimate.com/v1/badges/4445cb074eab29b4ba42/maintainability)](https://codeclimate.com/github/pixelcollective/laravel-mix-wp-blocks/maintainability) [![npm version](https://badge.fury.io/js/%40tinypixelco%2Flaravel-mix-wp-blocks.svg)](https://badge.fury.io/js/%40tinypixelco%2Flaravel-mix-wp-blocks)

## About

Laravel mix extension to transpile WordPress blocks.
Laravel mix extension to transpile WordPress block scripts.

## Installation

```sh
npm install @tinypixelco/laravel-mix-wp-blocks --save-dev
```

`npm install laravel-mix-wp-blocks --save-dev`
`yarn add -D laravel-mix-wp-blocks`
```sh
yarn add -D @tinypixelco/laravel-mix-wp-blocks
```

## Usage

In webpack.config.js:

```js
require("laravel-mix-wp-blocks")
require("@tinypixelco/laravel-mix-wp-blocks")

mix.block('resources/assets/scripts/blocks.js', 'scripts')
```

Now you have access to all dependencies using `@wordpress` package import syntax. Example:
By doing so you'll find that you can now utilize all `@wordpress` scoped dependencies using ECMAScript 6 import syntax. Example:

```
```js
import { RichText } from '@wordpress/block-editor'
```

You will also find a json file accompanying each script (in your `dist` dir) containing all the `@wordpress` dependencies utilized by that script.
These packages are included as [webpack externals](https://webpack.js.org/configuration/externals/), so there is no reason to add them to your package file.

You can use that JSON file when enqueing your block in PHP to make sure your declared dependencies always match up with your actual usage.
You will also find a php manifest file accompanying each script in your distribution directory. This file declares an array of dependencies based on what you've used in your scripts. Require it and you're set.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Block extends JavaScript {

webpackPlugins() {
const WordPressDependencyExtraction = require('@wordpress/dependency-extraction-webpack-plugin')

return new WordPressDependencyExtraction()
}

Expand Down
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"name": "laravel-mix-wp-blocks",
"version": "0.2",
"name": "@tinypixelco/laravel-mix-wp-blocks",
"version": "1.0.0",
"description": "Laravel mix extension to transpile WordPress blocks.",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/kellymears/laravel-mix-wp-blocks"
"url": "https://github.com/pixelcollective/laravel-mix-wp-blocks"
},
"keywords": [
"laravel",
"laravel mix",
"mix",
"wordpress"
"laravel mix",
"wordpress",
"gutenberg",
"react"
],
"author": "Kelly Mears",
"author": "Kelly Mears <[email protected]> (https://kellymears.me)",
"license": "MIT",
"bugs": {
"url": "https://github.com/kellymears/laravel-mix-wp-blocks/issues"
"url": "https://github.com/pixelcollective/laravel-mix-wp-blocks/issues"
},
"homepage": "https://github.com/kellymears/laravel-mix-wp-blocks#readme"
}
"homepage": "https://github.com/pixelcollective/laravel-mix-wp-blocks#readme"
}

0 comments on commit 390cd8d

Please sign in to comment.