How to use Minify without composer #83

Closed
matthiasmullie opened this Issue Nov 19, 2015 · 4 comments

Projects

None yet

4 participants

@matthiasmullie
Owner
matthiasmullie commented Nov 19, 2015 edited

1: Clone this (minifier) repository: https://github.com/matthiasmullie/minify. Make sure you leave the directory structure intact (the files in data/js should stay in the same location relative to src/JS.php)

2: Clone path-converter repository: https://github.com/matthiasmullie/path-converter

3: Include all files from both projects.
Assuming you cloned both projects to /path/to/libraries/, that would look like this:

// make sure to update the path to where you cloned the projects to!
$path = '/path/to/libraries';
require_once $path . '/minify/src/Minify.php';
require_once $path . '/minify/src/CSS.php';
require_once $path . '/minify/src/JS.php';
require_once $path . '/minify/src/Exception.php';
require_once $path . '/minify/src/Exceptions/BasicException.php';
require_once $path . '/minify/src/Exceptions/FileImportException.php';
require_once $path . '/minify/src/Exceptions/IOException.php';
require_once $path . '/path-converter/src/Converter.php';

4: Use minifier! E.g.:

use MatthiasMullie\Minify;
$minifier = new Minify\CSS('body { color: red; }');
echo $minifier->minify();
@dmitry-git

Thanks It works.
But how to use short links here?
For example: domain.com/min/?f=... in link tag?

@PaoloFalomo
PaoloFalomo commented May 12, 2016 edited

⚠️ over here. If you use clone it will add /tests/ folders too. And it's not necessary to upload them. Could you please give us a non-composer-needed blob?

@tjespe
tjespe commented May 30, 2016

Is the path-converter library really necessary? What does it do?

@matthiasmullie
Owner

Yes it is. It will convert relative paths in your CSS files if the location of the minified files is different from the source file. It also fixes relative paths inside @imported files, when their content is included in the main minified code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment