Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peterdavehello/web-minify-helper
Help web developer to make their js & css files minified easily!
https://github.com/peterdavehello/web-minify-helper
css hacktoberfest js minify shell web
Last synced: 3 months ago
JSON representation
Help web developer to make their js & css files minified easily!
- Host: GitHub
- URL: https://github.com/peterdavehello/web-minify-helper
- Owner: PeterDaveHello
- Created: 2014-04-04T21:24:26.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T21:03:09.000Z (about 2 years ago)
- Last Synced: 2024-10-19T23:24:15.761Z (3 months ago)
- Topics: css, hacktoberfest, js, minify, shell, web
- Language: Shell
- Homepage:
- Size: 35.2 KB
- Stars: 14
- Watchers: 4
- Forks: 14
- Open Issues: 14
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Web minify helper!
[![Gitter chat](https://badges.gitter.im/PeterDaveHello/web-minify-helper.svg)](https://gitter.im/PeterDaveHello/web-minify-helper)
[![dependencies Status](https://david-dm.org/PeterDaveHello/web-minify-helper/status.svg)](https://david-dm.org/PeterDaveHello/web-minify-helper)Let me help you minify css and js files automatically and easily!
This is only a shell script; it depends on bash shell, grep, curl and nodejs/npm.
It is based on [clean-css](https://github.com/jakubpawlowicz/clean-css), [uglify-js](https://github.com/mishoo/UglifyJS2) and [javascript-minifier.com](https://javascript-minifier.com)/[cssminifier.com](https://cssminifier.com).
Feel free to contribute to the project if you want!
## Requirements
- Bash shell
- grep
- curl
- Node.js >= (4.0)## How to use?
```sh
$ git clone --recursive https://github.com/PeterDaveHello/web-minify-helper.git
$ cd web-minify-helper
$ npm install
```First go to the target directory you want to minify, then run the script(`path_of_script/minify.sh`). Or you can pass the directory's path as a parameter to the script!
You may even place the script file (or make a link to it) under the `$HOME/bin` directory, allowing you to conveniently run this script from any directory!
## Explanation
The script will scan all the directories under the current working directory, except path with '.git'.
Then, it will check all the js & css files to see if they already have a minified version (currently, it recognizes it by looking for a `.min` in the filename, before the file extension).
If the file does not have a minified version, it will minify it.
Furthermore, even if there is a minified version available, the script will compare the last modified time between the original file and its minified version. If the original one is newer than the minified one -- which means the minified file is older than the original -- then it will replace the old minified file with a new minified version!