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

stratify-web

v1.3.1

Published

A simple tool to build out a static website using nothing but Markdown.

Downloads

7

Readme

Stratify

A simple tool to build out a static website using nothing but Markdown. Useful for static blog sites and feeds.

Read the writeup

You can read a documented process of building this tool here.

Get Started

npm i -g stratify-web

Min Requirements

NodeJS > 14.0.0

Create a New Project

create-stratify-project <Directory Path> <App Name>
cd <Directory Path>

This creates a simple project at the directory path.

Editing Your Pages

Use the pages folder to make changes to your pages. They support comments, all markdown is rendered to static HTML at build time.

pages/index.md -> index.html post build
pages/subpages/subpage.md -> subpages/subpage.html post build

<!--
Supports HTML style Comments
-->

To change the title of the page, just add this to the top of the file.

<!--
Title: Page Title
-->

Templates

There will be inevitably times when you want to add new stylesheets to the project, or include external scripts, in those cases, the power of plain HTML can come in handy. You can use the template pre-provided in the templates directory or create new ones for each page.

If you have a page post-1.md, you can create a templates/post-1.html file and it will be picked up, if a matching template name is not found, the builder defaults to the templates/index.html file. If no templates are found, the html output generated is a simple conversion of the markdown to HTML.

An example of a template is:

<html>
	<head>
		<title>{{ title }}</title>
		<!-- Add your desired stylesheets here -->
	</head>
	<body>
		<!-- This serves as a template for your file, 
			add stylesheets, 
			scripts or any other properties that you need common in your pages.
		-->
		{{ content }}
	</body>
</html>

{{ title }} and {{ content }} are dynamically replaced with the title and content of the page at build time, support for more dynamic fields coming soon.

Static Assets

Put your static assets like images, videos and other files in the public folder. They are automatically moved to the build output and are available in the same directory as the finally built pages.

Environment Variables

Although a markdown based file should not have environment variables, you can use environment variables in templates.

Make sure to start your environment variables with STRATIFY_APP_ and save them in .env file.

<html>
	<head>
		<title>{{ title }}</title>
		<!-- Add your desired stylesheets here -->
	</head>
	<body>
		<!-- This serves as a template for your file, 
			add stylesheets, 
			scripts or any other properties that you need common in your pages.
		-->
		{{ content }}
	</body>
	<script type="text/javascript">
		const variable = process.env.STRATIFY_APP_ENV_VARIABLE;
	</script>
</html>

Building your project

stratify build

This compiles your markdown pages to HTML and puts them in the build folder. This folder can then be served through a CDN or hosting provider like Vercel, Netlify since it's completely static.

Serving Build Output

Once the build for your project is complete, you can run:

stratify start

It internally uses serve to serve the build output.

Running the dev server

The dev server has hot reloading enabled for development ease. Run the following command:

stratify dev

Contribution & Issues

Raise an issue

Create a Pull Request

Contributions and feedback are welcome, this is a weekend project built out of curiousity, any good changes will be merged.