Skip to content
Allows to add snippets blocks to your content: Javascript, CSS, HTML...
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets #11 - Fixed long lines Apr 16, 2019
docs New readme Mar 23, 2019
.gitignore First version Mar 23, 2019
.stylelintrc First version Mar 23, 2019 [#11] version++ Apr 16, 2019
index.php [#11] version++ Apr 16, 2019
phpcs.xml First version Mar 23, 2019
readme.txt [#11] version++ Apr 16, 2019
webpack.config.js Using libraries from npm Mar 26, 2019

Gutenberg Snippet block

Allows to add snippets blocks to your content: Javascript, CSS, HTML...


Add snippet blocks to your WordPress content using the new Gutenberg editor

Getting Started

  • Download the plugin into your 'plugins' folder.
  • cd into the folder
  • run composer install to install PHPCS
  • run npm install to install the project dependancies
  • run npm run build to compile the plugin assets

How to use it

Add a Snippet block within your content

Step 1

Include your code

Step 2

Select the language

Step 3

Save the post and check your front-end

Step 4

Supported languages

  • Apache
  • Bash
  • C#
  • C++
  • CSS
  • Erlang
  • Go
  • HTML
  • XML
  • Handlebars
  • JSON
  • Java
  • JavaScript
  • Markdown
  • Objective C
  • PHP
  • Python
  • R
  • Ruby
  • Rust
  • SCSS
  • SQL
  • Shell
  • Twig
  • TypeScript


Based in Making WordPress Do More Block Starter Kit

Original webpack configuration (before modifications) from Zac Gordon's Gutenberg Course.

Original deploy script (before modifications) from Garry Jones.

Webpack HMR thanks to Christian Glingener


If you want to use Webpack HMR, add these lines to your wp-config.php file. I tried to add them to the plugin but it is not allowed by WordPress plugin reviewers

$webpack_server_http_scripts_root   = 'http://localhost:3000';
$webpack_server_http_scripts_a_file = $webpack_server_http_scripts_root . '/blocks.js';

// phpcs:disable
if ( @file_get_contents( $webpack_server_http_scripts_a_file ) !== false ) {
	define( 'SW_BUNDLE_SCRIPT_BASE', $webpack_server_http_scripts_root );
// phpcs:enable


Read the changelog here

You can’t perform that action at this time.