Registry / devops / ngmin-with-comments

ngmin-with-comments

JSON →
library0.4.0jsnpmunverified

A fork of the original ngmin AngularJS dependency injection annotation minifier that preserves JavaScript comments during the minification process. Version 0.4.0 is the latest release. This package addresses issue #6 in the upstream grunt-ngmin repo by keeping comments intact, which some projects require for downstream tooling or documentation. It is functionally identical to ngmin except for comment preservation. The original ngmin is deprecated in favor of ng-annotate, and this fork should be treated as abandoned.

npm install ngmin-with-comments
INSTALL
IMPORT
SIG · NGMIN-WITH-COMMENT
N
ngmin-with-comments
devopsjavascriptv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ngmin
const ngmin = require('ngmin-with-comments');
import ngmin from 'ngmin-with-comments';
This package does not provide ES module exports. Use CommonJS require.
annotate
const { annotate } = require('ngmin-with-comments');
import { annotate } from 'ngmin-with-comments';
Named export with CommonJS destructuring; no ESM support.
default (as function)
const ngmin = require('ngmin-with-comments'); ngmin(src, options);
require('ngmin-with-comments').default(src);
The module exports the annotate function directly, not as a default property.

Shows how to use the package to minify an AngularJS file while preserving comments.

const ngmin = require('ngmin-with-comments'); const fs = require('fs'); const code = fs.readFileSync('app.js', 'utf8'); const minified = ngmin(code, { preserveComments: true }); fs.writeFileSync('app.min.js', minified); console.log('Minified with comments preserved.');
Debug
Known issues
deprecatedngmin is deprecated in favor of ng-annotate. This fork is unmaintained and should not be used in new projects.
fix
Replace with ng-annotate or use Babel/AngularJS plugin for annotation.
affects: >=0.0.0
breakingThe package does not support ES module imports; using `import` will fail.
fix
Use `require('ngmin-with-comments')` instead of ES imports.
affects: >=0.1.0
gotchaPreserving comments may cause issues with some minifiers or build tools that expect no comments.
fix
Ensure downstream tools are configured to handle comments or use a dedicated minifier.
affects: >=0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'ngmin-with-comments'
Package not installed or typo in package name.
fix
Run `npm install ngmin-with-comments` and check package.json.
TypeError: ngmin is not a function
Importing the default export incorrectly when using ES modules.
fix
Use `const ngmin = require('ngmin-with-comments');`
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
uglify-jsrequiredused for JavaScript AST manipulation and minification
Agent activity
2 hits · last 30 days
node
2
Resources
ngmin-with-comments — npm install ngmin-with-comments · libregistry