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

rollerblade

v1.4.5

Published

A command line tool and npm package to shortcut compiling typescript and scss bundles as well as compile markdown into minified HTML.

Downloads

9

Readme

Rollerblade

A command line tool and npm package to shortcut compiling typescript and scss bundles as well as compile markdown into minified HTML with front-matter.

Overview

Note: This is not and likely will never be as customizable as a build tool like webpack or rollup, but should be simpler (and possibly faster) to use for projects that do not require such a pipeline.

This utility was written and tested against Node 14.8.X.

Installation

To install globally for use as CLI

$ npm install -g rollerblade

To install as a package

npm install rollerblade

CLI Usage

rollerblade <input> [outputDir]

If the outputDir argument is not given, it will write into the current directory.

Multiple invocations are needed in order to compile multiple bundles.

Note: Source maps are automatically placed next to the output file with .map appended to the output file name.

Example

rollerblade ./src/index.scss ./out
rollerblade ./src/index.ts ./out

Javascript API

To use rollerblade with Node, you must import the function using ES modules syntax.

import { compile } from 'rollerblade'

This async compile function accepts a single string argument as the path to a file. The function returns a results object as defined below:

{
    file: { name: string, contents: Buffer | string },
    sourcemap?: { name: string, contents: Buffer | string },
    meta?: any
}

Supported 'Compilers'

Sassy Stylesheets [.scss, .sass]

Generates a bundled .css via Node Sass.

Typescript [.ts]

Generates a bundled .js via esbuild.

Markdown [.md]

Generates a minified .html file and extracts yaml metadata via marked and front-matter.

This compiler step is extended to support code highlighting and rendering LaTeX.

LaTeX Support

In order to render LaTex, this compilation step uses KaTeX within $ and $$ blocks.
You will need to include their stylesheet for proper styling.

Code Highlighting Support

The markdown parser supports code highlighting via highlight.js.
You will need to include one of their stylesheets for proper styling.

Anything Else [.*]

Files without a 'compiler' are simply read into memory to allow byte-for-byte copies.

Example

import { basename, extname, join, dirname, relative } from "path"
import { compile, utilities } from "rollerblade"
import { promises as fs } from "fs"

const { writeFile } = utilities

const sourceDir = "./src"
const outputDir = "./out"

async function compileFile(input) {

    // Construct source path
    input = join(sourceDir, input)

    // Wait for result to complete
    let { file, sourcemap, meta } = await compile(input)

    // Ensure same structured output directory exists
    let dir = join(outputDir, relative(sourceDir, dirname(input)))
    await fs.mkdir(dir, { recursive: true })

    // Write file to disk
    writeFile(file, dir)

    // Write sourcemap (if exists)
    if (sourcemap) {
        writeFile(sourcemap, dir)
    }

    // Write metadata as json (if exists)
    if (meta) {
        writeFile({
            name: basename(input, extname(input)) + ".json",
            contents: JSON.stringify(meta)
        }, dir)
    }
}

// Compile Sassy Stylesheet
compileFile("style/index.scss")

// Compile Typescript
compileFile("script/index.ts")

// Compile Markdown
compileFile("document.md")

// Compile Generic (ie, Copy file)
compileFile("asset.txt")