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

@nextbitlabs/onepunch

v2.6.2

Published

Command-line interface to create PDF presentations using web technology.

Downloads

40

Readme

onepunch

onepunch is a command-line interface to create PDF presentations using web technology.

onepunch is designed for designers, it does not provide any default style. Designers can write CSS files and link them in the index.html.

Prerequisites

To use onepunch, you should have installed node and npm in your system. Please follow the official instructions.

Install

Install onepunch globally with the following command:

$ npm install -g @nextbitlabs/onepunch

Please note that onepunch makes use of puppeteer, which will download chromium. This is necessary to print the PDF file.

Update onepunch to the latest release with:

$ npm update -g @nextbitlabs/onepunch

Create a project

$ onepunch init [-n directory-name]

The command above creates the directory directory-name with all the files needed to bootstrap the presentation.

The configuration file onepunch.json contains configuration parameters, with the following available:

  • width and height, numeric: slide width and height in pixels;
  • progress, string: available line, to show a progress line at the bottom of the page, or none, to suppress it;
  • date, string: presentation date, used by tags <span data-onepunch="date"></span> along the presentation;
  • slideNumber, bool: whether to visualize the slide number in tags <span data-onepunch="slide-number"></span>.

View the presentation

Inside the project directory, run:

$ onepunch serve [-i htmlfile]

The command above starts a local server and opens the browser, use the arrow keys to see the next and previous slides. Flag -i (or --input) specifies the HTML file to open, it defaults to "index.html".

Print the PDF

Inside the project directory, run:

$ onepunch print [-i htmlfile] [-o pdffile]

Flag -i (or --input) specifies the HTML file to print, it defaults to "index.html". Flag -o (or --output) specifies the name of the PDF file in output, it defaults to "index.pdf".

Update

Update onepunch to the latest release with:

$ npm update -g @nextbitlabs/onepunch

To align the src directory of a past presentation to the latest release of onepunch, first update onepunch itself with the command above, then use:

$ onepunch update

This will make any new feature available to the current presentation. Please note that any custom change inside directory src will be overwritten.

Create custom styles

Each slide is created by means of tag article, for example:

<main>

  <!-- Slide 1 -->
  <article>
    <header>
      <h1>My Presentation Title</h1>
    </header>
  </article>

  <!-- Slide 2 -->
  <article>
    <header>
      <h1>My Presentation Title</h1>
      <p>We use web technology to create PDF presentations.</p>
    </header>
  </article>

  ...

</main>

As usual, designers can define CSS classes to apply custom style. For example, the following class defines a specific grid layout:

.layout-1 {
  display: grid;
  grid-template-rows: minmax(50px, max-content) auto 50px;
  grid-template-columns: 100%;
  grid-template-areas:
    "A"
    "B"
    "C";
}

and can be used in the following way:

<article class="layout-1">
  <header style="grid-area: A;">
    ...
  </header>
  <section style="grid-area: B;">
    ..
  </section>
  <footer  style="grid-area: C;">
    ...
  </footer>
</article>