Skip to content
/ jslite Public

A token based Javascript compiler/minifier designed for compressing inline scripts on the fly, written in PHP

License

Notifications You must be signed in to change notification settings

hexydec/jslite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f2b7d65 · Jan 9, 2024

History

99 Commits
May 7, 2023
Jun 25, 2021
Jan 9, 2024
Jan 9, 2024
Dec 18, 2023
Aug 27, 2020
Aug 15, 2023
Aug 7, 2023
Jan 9, 2024
Jun 5, 2023
Aug 7, 2023

Repository files navigation

JSlite: PHP Javascript Minifier

A Javascript compiler designed for minifying inline scripts, written in PHP.

Licence: MIT Status: Stable Tests Status Code Coverage

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.