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

jenkins-handlebars-rt

v1.0.1

Published

Jenkins CI Handlebars Runtime JavaScript module

Downloads

16

Readme

Handlebars module bundle (see jenkins-js-modules).

import this bundle (see jenkins-js-modules) into your application bundle (in your plugin etc) instead of bundling Handlebars in your application bundle, making your app bundle considerably lighter.

HPI Dependency

Your plugin needs to add a dependency on this plugin (to ensure it gets installed in Jenkins).

<artifactItem>
    <groupId>org.jenkins-ci.ui</groupId>
    <artifactId>handlebars</artifactId>
    <version>1.0-beta-4-SNAPSHOT</version>
</artifactItem>

Using Handlebars v3:

  • Bundle Id: handlebars:handlebars3

Using this bundle via the lower level import syntax (asynchronous) is not very easy because of how the Handlebarsify module interacts with the bundling process. For that reason, it is highly recommended to use the higher level require syntax (synchronous) on the handlebars NPM module, and then use a withExternalModuleMapping instruction (jenkins-js-builder) in the app bundle's gulpfile.js.

In either case, you should also add a runtime dependency on the jenkins-handlebars-rt NPM module:

npm install --save jenkins-handlebars-rt

require (sync)

If using jenkins-js-builder to create yor application bundle, you can code your application's CommonJS modules to use the more simple CommonJS style require syntax (synch), as opposed to the lower level import syntax (async) of jenkins-js-modules.

When doing it this way, your module code should require the standard handlebars NPM module (you should really only need to access handlebars if registering helpers - Handlebarsify looks after normal templating) e.g.

var handlebars = require('handlebars');

handlebars.registerHelper(name, helper);

Note: jenkins-js-builder has special built in support for Handlebars templates.

The above code will work fine as is, but the only downside is that your app bundle will be very bloated as it will include the handlebars NPM module. To lighten your bundle for the browser (by using a shared instance of handlebars), use jenkins-js-builder to create your app bundle (in your gulpfile.js), telling it to "map" (transform) all synchronous require calls for handlebars to async imports of the handlebars:handlebars3 bundle (which actually exports handlebars) e.g.

var builder = require('jenkins-js-builder');

//
// Use the predefined tasks from jenkins-js-builder.
//
builder.defineTasks(['test', 'bundle']);

//
// Create the app bundle, mapping sync require calls for 'handlebars' to 
// async imports of 'handlebars:handlebars3'.
//
builder.bundle('src/main/js/myapp.js')
    .withExternalModuleMapping('handlebars', 'handlebars:handlebars3')
    .inDir('src/main/webapp/bundles');

All of the above "magically" translates the appropriate bits of your app bundle's JS code to use async import calls (see below) in a way that just works.