New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

stripcomment-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stripcomment-loader

WebPack plugin to effectively strip comments

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

stripcomments-loader - A tiny loader to blanken your code.

While using UglifyJS over WebPack, I realized that the comments weren't stripped, actually. So I decided to write this loader that processes files and cleans them from comments - EXCEPT when debugging is enabled.

Usage

It's recommended to use this as a preLoaders entry to process multiple files that use either // or /* ... */ as comment indicators. Examples include JavaScript and CSS.

module.exports = {
    entry: "./test.js",
    output: {
        path: __dirname,
        filename: "bundle.js"
    },
    module: {
        preLoaders: [
            {
                test: /\.(js|css)$/,
                loader: "stripcomments?-lines"
            }
        ]
    }
}

Now just require any JS or CSS file, and you should see comments getting stripped.

To retain comments, set debug: true. In this case, comments are kept in-place.

Query options

You can control which and what is stripped:

stripcomments?-block

This will only strip block comments. Adding -line will only strip line comments. Supplying both or none, then all will be stripped. Passing +safe will have extra effects on which comments are to be removed.

Keywords

comments

FAQs

Package last updated on 07 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts