vrana/jsshrink

Remove spaces and comments from JavaScript code (available in PHP and JavaScript).

Maintainers

Package info

github.com/vrana/JsShrink

Language:JavaScript

pkg:composer/vrana/jsshrink

Statistics

Installs: 245

Dependents: 1

Suggesters: 0

Stars: 37

Open Issues: 0

dev-main 2025-03-19 21:30 UTC

This package is auto-updated.

Last update: 2026-03-09 04:42:33 UTC


README

JsShrink - Remove spaces and comments from JavaScript code
Available in PHP and JavaScript
Requires statements ending by semicolon, use JSHint or JSLint to verify.

https://vrana.github.io/JsShrink/

Usage PHP:
<?php
include "jsShrink.php";
echo jsShrink($code);
?>

Usage JavaScript:
<script type="text/javascript" src="jsShrink.js"></script>
<script type="text/javascript">
textarea.value = jsShrink(code);
</script>

Note:
Google Closure Compiler is much more powerful and efficient tool.
JsShrink was created for those looking for PHP or JavaScript only solution.
Most other JS minifiers are not able to process valid JavaScript code:
http://php.vrana.cz/minifikace-javascriptu.php#srovnani