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

cindex

v2.0.0

Published

Simple content indexer for websites.

Downloads

171

Readme

cindex

Description

The cindex (content indexer) package is a simple CLI (command line interface) tool used to quickly create web pages based on html templates.
The templates only have to meet a few html class names in order to be used.

 
 


Prerequisites

  1. npm and NodeJs (>=10.0.0)

 

Getting started.

Install package

npm i cindex

 
 


Usage

  1. Initialize in current directory
    cindex init .

By default the following directories are created:

│   cindex.json
│   index.html
│   style.css
│
├───drafts
│       sample.html
│       
├───index
│       _index.html
│
├───pages
│
└───template
        page.html
  1. Generate pages
    cindex gen .

This command will scan the drafts directory (by default) and create a new page using template/page.html.
The new page will be created under pages directory and it will be indexed in landing page index.hml

  1. Update pages
    cindex up .

This command will generate new pages and additionally scan for any changes in files inside the drafts directory (by default) and regenerate pages if needed.
Any pages whose matching draft has been deleted, will be deleted and removed from index.

Any page manually added to the pages directory will not be deleted by the update command.
cindex will check for class cindex-gen on the head tag of a page to recognize if a page should be deleted when it does not have a matching draft.

  1. Regenerate index
    cindex re .

This command will regenerate the pages index in case it gets messed up.

 
 


Creating new content

  • In a new draft: For every new page that is to be created, the draft must contain a tag with class:
          page-title   This class will be used to create a link in the index, as well as for the page title.

  • In a tempmlate: You can add, remove and modify any element in the default template, or create your own. The template must contain a tag with the following class:
          page-content   This class will be used to inject your draft's contents.

  • In an index.html file: You can add/remove and modify any element in the index page, or create your own. The index must contain a tag with the following class:
          pages-index   This class will be used to create and update the content index.

  • In _index.html file: A tag with the following class:
          cindex-index   This class will be used by the reindex function.

 
Note 1: You can append additional classes to the tags with cindex classes above.  
Note 2: You can delete all content from the sample/default files as long as you use the same directory structure, and cindex classes above.