hexydec / jslite
A token based Javascript parser/minifier designed for compressing inline scripts on the fly, written in PHP
Installs: 6 323
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- hexydec/tokenise: 1.0.1
Requires (Dev)
- phpunit/phpunit: 10.1.2
README
A Javascript compiler designed for minifying inline scripts, written in PHP.
Description
Designed to complement HTMLdoc, JSlite is a Javascript compiler and minifier, designed for minifying inline Javascript on the fly. It can also be used for compressing larger documents.
The software is implemented as a compiler to ensure reliable, and comes with a full test suite.
Usage
To minify Javascript:
use hexydec\jslite\jslite; $doc = new jslite(); // load from a variable if ($doc->load($javascript) { // minify the document $doc->minify(); // retrieve the javascript echo $doc->compile(); }
You can test out the minifier online at https://hexydec.com/apps/minify-js/, or run the supplied index.php
file after installation.
Installation
The easiest way to get up and running is to use composer:
$ composer install hexydec/jslite
Test Suite
You can run the test suite like this:
Linux
$ vendor/bin/phpunit
Windows
> vendor\bin\phpunit
Support
JSlite supports PHP version 8.0+.
Documentation
Contributing
If you find an issue with JSlite, please create an issue in the tracker.
If you wish to fix an issue yourself, please fork the code, fix the issue, then create a pull request, and I will evaluate your submission.
Licence
The MIT License (MIT). Please see License File for more information.