Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload the page after webpack watch compile #3871

Merged
merged 6 commits into from Jun 2, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/client-assets.php
Expand Up @@ -183,6 +183,15 @@ function gutenberg_register_scripts_and_styles() {
filemtime( gutenberg_dir_path() . 'blocks/build/edit-blocks.css' )
);
wp_style_add_data( 'wp-edit-blocks', 'rtl', 'replace' );

if ( defined( 'GUTENBERG_LIVE_RELOAD' ) && GUTENBERG_LIVE_RELOAD ) {
$live_reload_url = ( GUTENBERG_LIVE_RELOAD === true ) ? 'http://localhost:35729/livereload.js' : GUTENBERG_LIVE_RELOAD;

wp_enqueue_script(
'gutenberg-live-reload',
$live_reload_url
);
}
}
add_action( 'wp_enqueue_scripts', 'gutenberg_register_scripts_and_styles', 5 );
add_action( 'admin_enqueue_scripts', 'gutenberg_register_scripts_and_styles', 5 );
Expand Down
232 changes: 232 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -100,6 +100,7 @@
"style-loader": "0.18.2",
"tinymce": "4.7.2",
"webpack": "3.10.0",
"webpack-livereload-plugin": "1.0.0",
"webpack-rtl-plugin": "github:yoavf/webpack-rtl-plugin#develop"
},
"jest": {
Expand Down
2 changes: 2 additions & 0 deletions webpack.config.js
Expand Up @@ -4,6 +4,7 @@
const webpack = require( 'webpack' );
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
const LiveReloadPlugin = require( 'webpack-livereload-plugin' );

// Main CSS loader for everything but blocks..
const mainCSSExtractTextPlugin = new ExtractTextPlugin( {
Expand Down Expand Up @@ -161,6 +162,7 @@ switch ( process.env.NODE_ENV ) {

default:
config.devtool = 'source-map';
config.plugins.push( new LiveReloadPlugin( { port: process.env.GUTENBERG_LIVE_RELOAD_PORT || 35729 } ) );
}

module.exports = config;