Giter VIP home page Giter VIP logo

imm-gutenberg-boilerplate's Introduction

Gutenberg Block Boilerplate

How-to: https://developer.wordpress.org/block-editor/how-to-guides/javascript/js-build-setup/

NPM COMMANDS

1. Initialize NPM

Open folder in terminal and run

npm init

Edit CAPITAL_WORDS during the process with your info

package name: (imm-gutenberg-boilerplate) PACKAGE_NAME
version: (1.0.0) PACKAGE_VERSION
description: PACKAGE_DESCRIPTION
entry point: (index.js) build/index.js
test command:
git repository:
keywords:
author: AUTHORNAME,
license: (ISC) GPL-3.0-or-later
	
About to write to .../package.json:

{
  "name": "YOUR_PACKAGE_NAME",
  "version": "YOUR_PACKAGE_VERSION",
  "description": "YOUR_PACKAGE_DESCRIPTION",
  "main": "build/index.js",
  "scripts": {
	"test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "YOUR_AUTHOR_NAME",
  "license": "GPL-3.0-or-later"
}

Is this OK? (yes) yes

2. Setting up build and start scripts

The @wordpress/script package can compile your code using build just once, or you can use start to run a watcher in terminal. In order to use this scripts you have to edit the package.json file just generated

...
	"scripts": {
		"start": "wp-scripts start",
		"build": "wp-scripts build"
	},
...

To use the scripts just run npm run start for development mode, or npm run build for package build.

3. Install packages

Now it's time to install necessary packages. Run

npm install --save-dev --save-exact @wordpress/scripts@27 @wordpress/i18n

4. Create the entrypoint

Now you can start writing your code editing index.js in src folder

imm-gutenberg-boilerplate's People

Contributors

andreagaspari avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.