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

moqq

v1.0.3

Published

Create device mockups from URLs or screenshots.

Downloads

10

Readme

moqq - minimalistic device mockups.

This package utilizes Jimp to compose device mockups. Currently only mockups with a pc are supported.

In action: andreev.work/projects

JS Docs

Classes

Typedefs

Moqq

Interfacing class

moqq.up(options) ⇒ string | Jimp

Composes a Jimp image consisting of devices with complementary screenshots as declared in options. Returns path to that image or the Jimp instance.

Kind: instance method of Moqq
Returns: string | Jimp - Path to resulting image or resulting Jimp instance

| Param | Type | Default | Description | | --- | --- | --- | --- | | options | object | | | | options.screenshots | object.<string, ImageInput> | | object with deviceNames as keys and paths, ArrayBuffers or Jimps as values. | | [options.resPath] | string | | path to resulting image (relative to caller location). | | [options.w] | number | 1280 | width of resulting image. | | [options.h] | number | 720 | height of resulting image. | | [options.returnJimp] | boolean | false | If true, a Jimp instance is returned. Otherwise image is saved to resPath. | | [options.background] | string | number | "0x00000000" | Background color as css string or hex number (0xrrggbbaa). | | [options.statusBar] | number | | What style status bar to add (moqq.STATUSBAR_LIGHT or moqq.STATUSBAR_DARK). Currently only vertical iPhone X is supported. | | [options.paddingX] | number | 0.8 | Horizontal padding relative to image width (0.0 - 1.0) | | [options.paddingY] | number | 0.8 | Vertical padding relative to image height (0.0 - 1.0) |

JS Usage

const moqq = new (require('moqq'))();
moqq.up({
  screenshots: {
    pc: 'path/to/pc.png',
    iphone_x: 'path/to/iphone_x.png'
  },
  resPath: 'path/to/result.png',
  w: 800,
  h: 600,
  statusBar: moqq.STATUSBAR_LIGHT,
  background: 'white'
}).then((fPath) => {
  console.log(fPath);
);

CLI

moqq-up [options]

Generate mock up from provided screenshots.

Options:
  --version         Show version number                                [boolean]
  --pc              Provide screenshot for PC.                          [string]
  --iphone_x        Provide screenshot for iPhone X.                    [string]
  --iphone_6/7/8    Provide screenshot for iPhone 6/7/8.                [string]
  --ipad            Provide screenshot for iPad.                        [string]
  -w, --width       Width of resulting image.           [number] [default: 1280]
  -h, --height      Height of resulting image.           [number] [default: 720]
  -b, --background  Background of resulting image as a css color string.
                                               [string] [default: "transparent"]
  -s, --statusbar   Style of status bar to add (none/light/dark). Currently only
                    supported for vertical iPhone X.  [string] [default: "none"]
  -o, --output      File to write resulting image to.
                                             [string] [default: "./mock-up.png"]
  --help            Show help                                          [boolean

CLI Usage:

Take a screenshot of your website using Chrome DevTools for all devices you need (choose device, Shift+Ctrl+P, type "Capture Screenshot"). Then feed them to the cli:

moqq-up --pc pc-screenshot.png --iphone_x mobile-screenshot.png -w 800 -h 600 -b transparent -o result.png