create-cloud-block icon indicating copy to clipboard operation
create-cloud-block copied to clipboard

A build-block npm script

Open SofiaSousa opened this issue 7 years ago • 2 comments

Last Cloud Blocks release (1.0.7) allows the upload of custom blocks via zip files.

Would be nice that generated blocks have a build-block script to create the zip file (which should include the build folder and package.json file at least).

My suggestion:

~~"build-block": "zip -r [block-name].zip build package.json"~~

"scripts": { 
  "build-block": "cd .. && zip -r [block-name]/[block-name].zip [block-name]/build [block-name]/package.json"
}

SofiaSousa avatar Nov 13 '18 15:11 SofiaSousa

Nice, but I'm also thinking: If you are familiar with the command line, you wouldn't upload a zip. You would edit .gitignore and add the block to your repo. Right?

perandre avatar Nov 14 '18 09:11 perandre

If you want to keep the blocks inside the wp project, editing the .gitignore is the right way.

But if you want to keep them in different repositories and upload the blocks through the UI, a build-block script could be useful.

To upload just a block, you don't have to update the whole site, just have to generate the block zip file and upload it.

For the block developer, it's just another npm command:

npm run build-block

SofiaSousa avatar Nov 14 '18 12:11 SofiaSousa