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 🙏

© 2026 – Pkg Stats / Ryan Hefner

file-copy-parse

v1.0.0

Published

File parser plugin for Webpack. Can also work as a standalone package. Does template variable replacement and, optionally, some basic compression and comment removal.

Downloads

15

Readme

file-copy-parse

A NodeJS and Webpack plugin to copy (UTF) and parse files from one location to another. The parsing process contains the following (optional tasks) tasks:

  • Compression. It does only the most basic compression, ie. removes all extra white spaces (extra spaces, line feeds, tabs etc.).
  • Template literal replacement. Any string defined as a template variable in the "templateVars" property will be replaced by the value of your choice
  • Comment Removal. Can remove HTML and Javascript (single and multi-line) comments

Requirements

  • NodeJS >= 5

Installation

npm install file-copy-parse --save-dev

Import

All you need to do is require it in your webpack config, eg.:

const MarkupGenerator = require('file-copy-parse');
...
{
    entry: {
        ...
    }
    ...
    plugins: [
        new MarkupGenerator(options)
    ]
}

API Documentation

TemplateParser

Generate a compressed file at a target location, and replace any template literal variables present with a specific value

Parameters

  • params (array | object) The configuration for one or more sources and destinations
    • params.sourceFiles (string | array) Either the list of files you need to minify and cache bust, or a globbing pattern
    • params.sourceRoot string The root folder (lowest common folder) that the source files are located in
    • params.targetRoot string The root folder (lowest common folder) that the processed files should be written to
    • params.templateVars (object | function)? An object (or function returning an object) that will contain the values associated with any template literal variables included in the source file If you have the keyword '[hash]' as one of the templateVar values, then the md5 hash of the target file will replace the '[hash]' placeholder. Example usage: templateVars: { '?cache=true': '?[hash]' } (optional, default {})
    • params.compress boolean? Remove all extra white spaces, line feeds, tabs etc. (optional, default false)
    • params.discardComments boolean? Remove all Javascript and HTML comments from the file (optional, default false)
    • params.webpack boolean? Determines whether or not the method should be executed as a Webpack plugin. The '[hash]' replacement works only as a Webpack plugin (optional, default true)

Returns void

Changelog

  • 1.0.0
    • Bug fixes
    • Updated the logic in the "done" event of the Webpack flow
  • 0.1.1
    • Minor bug fixes and unit tests
    • Added MD5 hash functionality
    • Added Travis CI functionality
  • 0.0.8
    • Initial version