https://github.com/carry0987/minifyjs
This is a code minification tool based on Docker and Node.js, minifying JavaScript files with uglify-js, and operated by API requests
https://github.com/carry0987/minifyjs
docker docker-compose javascript minifier nodejs uglify-js
Last synced: about 2 months ago
JSON representation
This is a code minification tool based on Docker and Node.js, minifying JavaScript files with uglify-js, and operated by API requests
- Host: GitHub
- URL: https://github.com/carry0987/minifyjs
- Owner: carry0987
- License: mit
- Created: 2023-07-09T13:29:12.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-09T14:57:07.000Z (almost 2 years ago)
- Last Synced: 2025-02-05T00:28:18.408Z (3 months ago)
- Topics: docker, docker-compose, javascript, minifier, nodejs, uglify-js
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MinifyJS
This is a code minification tool based on Docker and Node.js, suitable for JavaScript files. The project leverages uglify-js library for file minification.## Features
- Accepts JavaScript files through API for minification.
- Outputs the minified files directly or saves them to a specific directory.
- Configured with docker-compose as an easy deployment and for persistence.## Installation
1. Download or clone this repository to your local machine.
2. Navigate to the directory of the repository and run the `docker-compose up -d` command to create and start the service.## Usage
Send the JavaScript file you wish to compress to `/compress` API, the file will be compressed accordingly and returned based on the request.For example:
```
curl -X POST -F 'file=@/path/to/your/js/file.js' "http://localhost:3000/compress?request=file"
```
In this example, `request=file` means you wish to save the compressed JavaScript file to a specified `compressed` directory and return the metadata of the file. If you wish to return the content of compressed file directly, you can use `request=content` or completely ignore the `request` parameter.For example:
```
curl -X POST -F 'file=@/path/to/your/js/file.js' "http://localhost:3000/compress?request=content"
curl -X POST -F 'file=@/path/to/your/js/file.js' "http://localhost:3000/compress"
```## Note
If no path is specified, files will be saved in the `compressed` directory.## License
This project is licensed under the terms of the MIT license.