JSPM

  • Created
  • Published
  • Downloads 573
  • Score
    100M100P100Q103635F
  • License MIT

Recursively minify all JavaScript files

Package Exports

  • @adamlui/minify.js
  • @adamlui/minify.js/minify.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@adamlui/minify.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

</> minify.js

Recursively minify all JavaScript files.


⚡ Installation

As a global utility:

npm install -g @adamlui/minify.js

As a dev dependency, from your project root:

npm install -D @adamlui/minify.js

💻 Usage

The basic global command is:

minifyjs

💡 Note: Pass -n or --dry-run to only see what files will be processed.

To specify input/output paths:

minifyjs [input_path] [output_path]
  • [input_path]: Path to JS file or directory containing JS files to be minified, relative to the current working directory.
  • [output_path]: Path to file or directory where minified files will be stored, relative to original file location (if not provided, min/ is used).

💡 Note: If folders are passed, files will be processed recursively. To include dotfolders, pass -dd or --include-dotfolders. To include dotfiles, pass -df or --include-dotfiles.

To use as a package script, in your project's package.json:

  "scripts": {
    "build:js": "<minify.js-cmd>"
  },

Replace <minify.js-cmd> with minifyjs + optional args. Then, npm run build:js can be used to run the command.

📃 Example commands:

  • Minify all JavaScript files in the current directory (outputs to min/):

    minifyjs
  • Minify all JavaScript files in a specific directory (outputs to path/to/your/directory/min/):

    minifyjs path/to/your/directory
  • Minify a specific file (outputs to path/to/your/min/file.min.js):

    minifyjs path/to/your/file.js
  • Specify both input and output directories (outputs to output_folder/):

    minifyjs input_folder output_folder

🏛️ MIT License

Copyright (c) 2024 Adam Lui

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Home / Discuss / Back to top ↑