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

fragment-include

v0.0.2

Published

Wash your files with this preprocessor and DRY

Downloads

4

Readme

                                 .("""")                                      (j)
                               (_(_ __(_ )                                 (n o d e)
             _                   / / /                       (n)              (s)
 )) ) ) ___  )_ __ __           / / /           n            \|/              \|/
((,(,' (_(| (_ (('(|             n             \|/            |                |

Part of the Node Water collection.

Introduction

  • fragment-include - Wash your files with this preprocessor and then DRY.

So What Does it Do?!

It's a command line tool call called fipp (fragment include pre-processor), that helps you include fragments from some files into others, so you Dont Repeat Yourself.

Great for including examples from your code in your documentation.

How Does it Work?

fipp instructions are embedded in your files using comments. This means they won't effect the normal use of your files, but fipp parse for and use them.

There are two kinds of files fipp works with, source and target. The most basic use of fipp is:

fipp <target>

fipp will parse the target file looking for fragment-include* instuctions which it replaces with fragments from source files. Fragments in the source files are denfined using fragment-define* instuctions. There are five instuctions in total.

  • fragment-include {source}{fragmentid} - shorthand for pair of fragment-include-start and fragment-include-end tags.
  • fragment-include-start {source}{fragmentid} - the start of a fragment-include region in a target file.
  • fragment-include-end - the end of a fragment-include region in a target file.
  • fragment-define-start {fragmentid} - the start of a fragment definition in a source file.
  • fragment-define-end - the end of a fragment definition in a source file.

fipp uses the following logic.

  1. Replaces any fragment-include instructions with a pair of fragment-include-start and fragment-include-end instructions.
  2. Anything between a fragment-include-start and fragment-include-end instruction is defined as an include region.
  3. Extracts all {source}{fragmentid} references from the fragment-include-start {source}{fragmentid} instructions.
  4. Extracts the fragments from the source files specified by {source}. Fragments are defined as everything between a fragment-define-start {fragmentid} and a fragment-define-end instruction.
  5. Inserts the fragments extracted from source files into the include regions defined in the target file.

Comments Reference

  • .html or .md - comments must start with <!--- and end with --->.
  • .js - comments must start with /*** and end with ***/.

Installation

Official releases can be obtained from:

  • github.com - the tags section provides links to zip or tar.gz packages.
  • npm - use npm install -g fragment-include

The lastest developed code may node have not have been released, but can always be found from:

  • github.com - the project homepage provides links to all the source code, branches and issue tracking.

Help

See the output of fipp --help