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 🙏

© 2025 – Pkg Stats / Ryan Hefner

schlump

v0.17.0

Published

A static site generator utilizing reactjs

Downloads

96

Readme

schlump

license npm Build Status Build status Coverage Status dependencies Status devDependencies Status Commitizen friendly Standard Version

A static site generator utilizing reactjs.

schlump generates html and copies your static resources into a give folder structure. Aftewards the generated html is validated for consistency.

Installation

npm install schlump

Quickstart

Create the following folder structure:

src
src/pages     <-- place your content here
src/templates <-- place your page components here
src/statics   <-- place all static assets here
src/helpers   <-- place all helper functions here (optional)
./node_modules/.bin/schlump

The result is written into the dist folder.

Usage

$ schlump

Usage
  $ schlump [options]

Options

  --help, -h             Usage information
  --src                  Source folder (defaults to src)
  --src-pages            Folder to look for pages (default to <src>/pages)
  --src-templates        Folder to look for templates (defaults to <src>/templates)
  --src-statics          Folder to look for static files (defaults to <src>/statics). Repeat for mulitple sources.
  --src-helpers          Folder to look for helper functions (defaults to <src>/helpers)
  --dest                 Destination folder (defaults to dist)
  --dest-statics         Folder to write statics (defaults to <dest>/statics)
  --var.<name>=<value>   Define global properties which are usable during build pages
  --disable-validation   Disable html validation (no link and resource checking)
  --redirect-map         A json file with key value pairs of url-path (source) and full qualifed urls (target)
  --scoped-css           Path of the file to write all scoped css to
  --css-variables        Enable support for css-variables
  --template-import='<file-or-node-module-path>[:<namespace>]'
                         Imports the react-components from the given path at the given namespace

Examples
  $ schlump # Execute with default
  $ schlump --src-statics=./statics-one --src-statics=./statics-two

Pages

Pages in schlump are JSX files (only the JSX code without JavaScript boilerplate). All pages are stateless function components which could have a frontmatter preamble. The frontmatter could contain a route entry to specify the URL of the page to create. All other frontmatter data is given to the page under the scope frontmatter.

---
route: /index.html
text: Content!
---
<p>{frontmatter.text}</p>

Templates

Templates for schlump are either JSX files (only the JSX code without JavaScript boilerplate), SVG files or Markdown files. All templates are stateless function components which could have as well a frontmatter preamble.

The component name is either given in frontmatter as name or derived from the file name.

For example in a file named src/templates/my-component.html:

---
name: MyComponent
---
<div>
    {props.message || 'Lorem ipsum'}
</div>

This template (component) could then be used in a page with the name MyComponent.

For example in a file named src/pages/index.html:

<MyComponent message="Hello World!" />

Helpers

Helpers are functions which could be used in all templates.

Helpers must export a function at module.exports, the name of the helper is deduced from the camel-cased file name of the helper function.

For example in a file named src/helpers/hello-world.js:

module.exports = function () { return 'Hello World!'; };

This results in a helper which could be called in a template like this:

<div>
    {helpers.helloWorld()}
</div>

Note: The helpers are only availalbe in templates, NOT in pages.

Globals

Global variables which are available in all pages. These values are available as top-level props.

If schlump is executed with schlump --var.foo=bar and the following page:

<div>
    {props.foo}
</div>

this html is rendered as result: <div>bar</div>.

Validation

Currently the following elements get validated:

  • a[href] - relative links to pages must exist (no dead links)
  • img[src] - relatie image resources must exist
  • img[srcset] - relatie image resources must exist
  • *[style] background-image - relative resources in inline-style background-images must exist
  • link[href] - relative external resources must exist

Redirects

Given schlump is started with the parameter --redirect-map map.json and map.json contains:

{
  "/old/page/url": "https://github.com/sinnerschrader/schlump"
}

then schlump generates a page at <dest>/old/page/url/index.html which contains a meta refresh to https://github.com/sinnerschrader/schlump.

Scoped CSS

Pages and Templates could have a scoped css tag which contains the styles of that component. Only simple selectors are possible which implicitly means that the style rules are scoped to that component.

For ease of use and to keep templates dry and reusable css-variables have been implemented. That includes full support for inheritance/scoping. (Note: There is no interoperability between javascript and css. This means it is not possible to dynamically set variables.)

---
name: Element
---
<style scoped>
.element {
    color: blue;
    background-color: var(--common-background-color);
}
.element h1 {
    color: green;
}
h1 + p {
    color: red;
}
</style>
<div className={style.element}>
    <h1>headline<h1>
    <p>
        copytext
    </p>
</div>

Template Imports

With the option --template-import it is possible to integrate external React libraries (e.g. elemental ui) into schlump sites.

The libraries are either referenced from node_modules (e.g. elemental) or by relative path (e.g. ./node_modules/elemental) and could be imported into an optional given namespace.

$ # This would import elemental-ui into the namespace UI
$ schlump --template-import='elemental:UI'

Afterwards all components of the library could be used with the given namespace.

<body>
    <UI.Button/>
</body>

The option could occurr multiple times on the cli. If there are name clashes in the namespace and module names, the last given option overwrites former imports.

If there is no namespace given, then the library is imported into the default schlump template space. But it is not possible to overwrite local schlump templates by an imported library.


schlump is built with JavaScript and :heart: and released under the MIT license.