简体   繁体   中英

A simple javascript/jQuery minifier in PHP

I want to compress my JS and jQuery code using the following method:

<?php
require_once(dirname(__FILE__).'/minifier.php');
header("Content-Type:application/x-javascript");

//here catching and gzip {...]

//This file will be compressed.
ob_start("minifier");
?>

... here a lot of javascript code ...

I've tried jsmin https://github.com/rgrove/jsmin-php/ , but it's not maintained anymore. I'd prefer something easier... Any help?

Thanks!

I've been using mlitn's package for this kind of task.

Works flawlessly out of the box

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM