Skip to content

Commit

Permalink
Switch to using webpack define plugin to inject a global GUTENBERG_PH…
Browse files Browse the repository at this point in the history
…ASE variable
  • Loading branch information
talldan committed Jan 24, 2019
1 parent faa168a commit 53eb3a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"precheck-local-changes": "npm run docs:build",
"check-local-changes": "( git diff -U0 | xargs -0 node bin/process-git-diff ) || ( echo \"There are local uncommitted changes after one or both of 'npm install' or 'npm run docs:build'!\" && exit 1 );",
"predev": "npm run check-engines",
"dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev": "cross-env GUTENBERG_PHASE=2 npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev:packages": "node ./bin/packages/watch.js",
"docs:build": "node docs/tool",
"fixtures:clean": "rimraf \"test/integration/full-content/fixtures/*.+(json|serialized.html)\"",
Expand All @@ -168,7 +168,7 @@
"lint-pkg-json": "wp-scripts lint-pkg-json ./packages",
"lint-css": "wp-scripts lint-style '**/*.scss'",
"lint-css:fix": "npm run lint-css -- --fix",
"package-plugin": "./bin/build-plugin-zip.sh",
"package-plugin": "cross-env GUTENBERG_PHASE=2 ./bin/build-plugin-zip.sh",
"postinstall": "npm run check-licenses && npm run build:packages",
"pot-to-php": "./bin/pot-to-php.js",
"precommit": "lint-staged",
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
const { DefinePlugin } = require( 'webpack' );
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
const LiveReloadPlugin = require( 'webpack-livereload-plugin' );
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
Expand Down Expand Up @@ -105,6 +106,10 @@ const config = {
],
},
plugins: [
// Inject the `GUTENBERG_PHASE` global, used for feature flagging.
new DefinePlugin( {
GUTENBERG_PHASE: JSON.stringify( process.env.GUTENBERG_PHASE || 1 ),
} ),
// Create RTL files with a -rtl suffix
new WebpackRTLPlugin( {
suffix: '-rtl',
Expand Down

0 comments on commit 53eb3a1

Please sign in to comment.