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

iaweb

v1.0.2

Published

iA Web, a simple publishing engine

Downloads

14

Readme

iA Web

iA Web is a simple publishing engine based on the Darkside.js framework.

The core concept behind this engine is that it reads HTML exports from iA Writer, an awesome Markdown app, and presents them in form of a blog.

Usage

npm install iaweb

The bootstrapping script is then as simple as

var iaweb = require('iaweb');
var app = iaweb.create(__dirname);
app.listen(process.env['PORT']);

When you run this script, the most basic blog is presented to you.

Content

To add content (blog posts), create a folder called posts in your app directory and place HTML exports from iA Writer in it.

The filenames are the identifiers of the posts. If a file is names a-cool-post.html, its URL is '/a-cool-post'.

Static resources

Static resources such as images, CSS or JavaScript are looked up in a folder called public.

Plugins

You can add custom plugins to the engine. They can only modify posts before they are displayed. A sample plugin can look like this:

var IMG_EXPRESSION = /\[\[IMG:([^\]]+)\]\]/;

exports.handler = function (post) {
  post.content = post.content.replace(IMG_EXPRESSION, function (match, file_path) {
    return '<img src=' + file_path + '">';
  });
  post.content = content;
};

Place them in a folder called plugins.

Templates

The package includes the most basic templates required for the engine to work. You can use your own by creating a folder called views in your app directory.

The file/directory structure is:

[views]
- @layout.eco
- [post]
  - index.eco
  - show.eco

The templates are combined (it's always the @layout.eco + another template). There is a simple component system in the templates.

In @layout.eco, you request a component from the other template:
<%- @component 'content' %>

And in the other templates, you define it:
<% @component 'content', => %>
  Content
<% end %>

Check out the provided templates to get the idea what variables are provided.

Do I need to use iA Writer?

No, iA Writer is just the preferred method.

The way it works is that a <h1> tag content is the title of the given post and anything after the <h1> tag until the closing </body> tag is its content. Thus, a sample post can look like

<body>
<h1>Hey, a cool post!</h1>
<p>I'm a cool post.</p>
</body>