npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gebruederheitz/wp-block-skeleton

v1.0.0

Published

A skeleton for a quick gutenberg block module setup.

Downloads

3

Readme

WP Block: Video Overlay

A skeleton for a quick gutenberg block module setup.


Installation

> npm i @gebruederheitz/wp-block-skeleton

Usage

Skeleton

The simplest way to use the skeleton is with degit, which will clone this repository's contents while uncoupling it from git (so you can initialize a new one without fuss):

> npx degit @gebruederheitz/wp-block-skeleton ./wp-block-example
> cd wp-block-example
> git init 

Don't forget to:

  • delete this section and complete the Readme
  • change the package name in package.json
  • remove the hash from the script name at pkg.scripts.#prepublishOnly
  • change the repository URLs in package.json (repository.url, bugs, homepage)
  • check the licence
  • check whether you need all the dependencies

In the editor

import Block from '@gebruederheitz/wp-block-skeleton';

Block.register();

You may provide custom attributes, methods / components etc.:

import {register, attributes} from '@gebruederheitz/wp-block-skeleton';
import {MyIconComponent} from 'your/icon/components/path';

const customAttributes = {
    newAttr: {
        type: 'string',
        default: 'default value',
    },
    ...attributes,
};

const edit = ({attributes: {newAttr}}) => {
    return (
        <p>{newAttr}</p>
    );
};

register({
    attributes: customAttributes,
    edit,
    icon: <MyIconComponent />,
});

On the frontend

import { BlockFactory } from '@gebruederheitz/wp-block-skeleton';

new BlockFactory();

Rendering the block's output

You will need to register the block on the backend and provide a template to render the output. The composer library gebruederheitz/wp-block-xxx will take care of that for you.

Data supplied by the backend

The block expects some data to be present on the global window object, which need to be supplied by the WP backend. Again, the composer library gebruederheitz/wp-block-xxx does that out of the box.

window.editorData = {
    restCustomUrl: 'string', // REST API URL for the image Sideloader
    restApiNonce: 'string',  // The API nonce for request validation (CSRF/XSS)
    embedTypes: [], // An array of possible embed types when used with a consent management solution. Pass `null` to skip.
}

Styling

You may use and extend the default styles provided by this package in your (S)CSS:

// Your frontend SASS file

// Import the stylesheet
@use 'node_modules/@gebruederheitz/wp-block-skeleton/scss/skeleton' with (
  $variable: 'value',
);
// Your editor SASS file

// Import the stylesheet
@use 'node_modules/@gebruederheitz/wp-block-skeleton/scss/skeleton.editor';

Or use the precompiled CSS files:

<link 
  rel="stylesheet"
  href="/path/to/node_modules/@gebruederheitz/wp-block-skeleton/dist/skeleton.css"
/>
<link 
  rel="stylesheet"
  href="/path/to/node_modules/@gebruederheitz/wp-block-skeleton/dist/skeleton.editor.css"
/>