This WordPress plugin provides custom functionality for the creativecommons.org website.
After cloning the repository, install nodee modules using npm i
.
Create a new folder under the src
foder. Lets say, the new block called My Block
.
- Create the folder with the name my-block.
- It should have an
index.js
file. The file exports the block settings and name. The edit and save methods of block is the content you display in edit and display mode respectively. - There should be an edit.js and a save.js in the folder. It can just be a single file if display and edit modes are the same.
- For any other components, create a components folder under the
my-block
folder and add more js files inside it.
export const name = 'my-block';
export const settings = {
title: 'My Block',
description: 'A brief description of the block',
category: '<tab>',
icon: '<icon>',
edit:Edit,
save:Save
};
- Import the file in main
index.js
and, add an element inside the blocks array.
const blocks = [
...otherBlocks,
MyBlock
];
- Register the component inside using the following in the
wp-plugin-cc-gutenberg-blocks.php
file.register_block_type('common/users-list');
There you go, it is a ready to use component.
Below you will find some information on how to run scripts.
- Use to compile and run the block in development mode.
- Watches for any changes and reports back any errors in your code.
- Use to build production code for your block inside
build
folder. - Runs once and reports back the gzip file sizes of the produced code.
Since this plugin is to be used as a composer package, this repo needs to include the ReactJS build. So before creating a PR to this repo,
- run
npm run build
and - commit the build folder.
Note, you will need to run npm install
in order for the build process to work.
Thanks goes to these wonderful people (emoji key):
Alberto Trujillo González 💻 |
Brylie Christopher Oxley 📖 |
David Huertas 🚧 |
Floyd Mann 💻 |
Hugo Solar 💻 |
Kriti Godey 👀 |
Shailee Mehta 💻 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!