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

@velocitypartners/vsb

v4.22.2

Published

Velocity Project

Downloads

243

Readme

Velocity Project Plugin Baseplate Readme

This Wordpress plugin is responsible for all the backend related elements (functions, methods, classes, setup, config and Gutenberg blocks), as well as providing the default markup and styling for components, blocks and modules. These frontend facing foundation elements provide a starting point, and although they are developed to work out the box, they are ultimately overwritten/manipulated by the theme in order to provide a custom theme based experience.

Table of Contents

  1. CLI Commands
  2. Installation
  3. Helpers and Functions
  4. Asset Structure
  5. Gutenberg Blocks
  6. Hierarchy Mode

CLI Commands

The plugin uses gulp to help with task automation throughout development. Here are the available commands.

Build

Running the build command will automatically include minifcation of files (where applicable). This is generally used before deployment. Note: This command will also completely rebuild your build directory from scratch (i.e. deleting the existing directory and any files container within).

Run this command to rebuild your plugin:

gulp build

Watch

The watch command is generally used through development and will change files on an individual basis as modifications are made and saved. All changes are automatically output to your build directory, but non-minified. Note: watch will only work on files that exist before the task is running. If you create any new files you will need to restart the watch process to track any changes.

Run this command to start the watch process:

gulp watch

Optional arguments

| Arg | Result | | --- | ------ | | --nosync | Disables browser-sync refresh on file save |

Installation

Clone this repository into a new folder and run:

npm install

Once complete run the build command (specified in the CLI Commands section) and then symlink the built plugin folder ('/dist/wp-content/plugins/') into your projects built plugin folder, ie:

ln -s /[path to your project folder]/www/wp-content/plugins/[plugin folder]/ /[path to this plugin folder]/dist/wp-content/plugins/

Helpers and Functions

The plugin is configured to be processed after_theme_setup. This means is that all functions, helpers, components, blocks etc... that exist within the theme architecture will be registered first. This allows us to manipulate the functionality of an element by virtue of the if (!function_exists([function name])) { statement, which you will notice wraps all of our functions. Therefore if the function has been registered by the theme already, the plugin function will be bypassed and the theme function will be the one fired when called.

Asset Structure

CSS

All CSS is compiled from SaSS partials using gulp-sass. Any stylesheets defined in the root of the styles working folder ('/src/assets/styles/') will be compiled into its own CSS file.

Compiled SCSS files must not begin with an underscore; underscored files will be ignored by the SaSS compiler, and should only be included as file partials.

JavaScript (excl. frameworks)

Files defined in /src/assets/scripts/main/ will compile to individual JavaScript files. Files defined outside of this directory will not compile to individual files, but may be used for inclusion as ES6 modules.

Gutenberg Blocks

By default the theme runs the allowed_block_types filter which means, for any block that isn't included in this list (via a plugin, or otherwise) it will not be made accessible to the theme. To modify which blocks are accessible to theme you should amend the file: inc/theme/v-allowed-gutenberg-blocks.php. This file controls all Wordpress core blocks, as well as any custom blocks (as defined in the $blocks_custom array).

Theme Blocks

The theme supports its own block registration. With this feature enabled all theme-defined blocks are automatically registered for inclusion via the allowed_block_types filter. To enable theme blocks add/uncomment the following in your wp-config.php file:

define( 'V_THEME_BLOCKS', true );

Most aspect of block registration is handled automatically, but each block requires a small amount of setup. It is crucial you understand and follow these steps carefully. Note: the values of [name] must be the same.

Dependencies

| File | Usage | | --- | ------ | | ./assets/scripts/block/vBlock[Name].jsx | Required for the Gutenberg editor. This should only contain the edit() method for controlling block behaviour in the admin. See below for more information on customisation. | | ./conf/v-block-[name].json | Contains all the configuration settings, attributes and properties that define the block | | ./inc/blocks/v-block-[name].php | Provides the callback for server-side rendering of the block. See below for more information on customisation. |

Block JSON

It is important that the object keys match those as specified within the Gutenberg API documentation. In addition to this there are two further callback parameters which are optional if you wish to go outside of the auto-generated approach:

| Parameter | Info | | --- | ------ | | editor | Specifiy the name of the file you have created for the Gutenberg editor. It must match the file given above. | | callback | Specifiy the function of the file you have created for the server-side rendering of the block. Note: Any specified attributes will automatically be registered for you and will be accessible within this callback function. |

Hierarchy Mode

Under the 'Document' tab, whilst editing a page/post, is a 'Hierarchy Controls' panel. If 'Activate Hierarchy Mode' is active, all the blocks within the page will display placeholder hierarchy styling and provide the user the option to add a label. When deactivated, the blocks will return to their regular configuration.

This is helpful at the start of development to allow us to see the general page structure/hierarchy before a design has been laid out.

Configuration of the heirarchy mode styles can be updated in the each respective block (/src/assets/scripts/blocks/vBlock[Name]) via the JSON const hierarchyModeDetails declared at the top of the page.

Pushing to NPM

to release a new version to NPM, run the following commands: npm version patch followed by npm publish where patch can be patch / minor / major you'll need to be logged into your NPM account on the CLI first, and your account will need to be added to the VP Dev NPM workspace to have permission to publish.