Minify php что это

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A PHP website interface for the YUI Compressor for minifying CSS and Javascript.

amereservant/PHP-Minify

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Читайте также:  Html file access is denied

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.textile

PHP Minify – Online YUI Compressor

PHP Minify is a website interface for the YUI Compressor, created to run on Ubuntu installs of the yui-compressor package. It allows the user to setup and run their own web-based YUI Compressor on a Ubuntu box with Apache, PHP and YUI -Compressor installed on it.

Credit for this project is due to the free resources made available by other open source contributors, since I more less just combined them together and can’t take credit for more than that. Here’s the list of resources used:

  • YUICompressor by Stephen Clay – This was where the core class of this project came from and credit for that is due to him.
  • CSS1K.com – Simpl Theme by Neofyt – The theme for this was based off of Neofyt’s theme and expanded on.
  • Initializr 2 – Used to create the base layout and has very useful helps for starting an HTML5 template.
  • Online YUI Compressor – This was my initial inspiration for this project. I’ve been using this site to minify code for a long time now and it wasn’t working one day when I needed it, so I created this project as a result. He shares his PHP — YUI -Compressor class and if I had noticed that at first, I probably would’ve used his class for this.

You MUST have a Ubuntu box with Apache, PHP5, and YUI -Compressor installed on it. A different distro of Linux can be used, but the commands will need to be corrected in the PHP_Minify class if the yui compressor can’t be executed via the yui-compressor
command.

  1. Install the YUI -Compressor: sudo apt-get install yui-compressor (This is assuming you’ve already installed Apache and PHP5)
  2. Create a directory in your webroot directory (Ex. /var/www/yui) and put the contents of this project in it.
  3. Change the ownership to the Apache user, sudo chmod www-data -R /var/www/yui .
  4. Visit the site and make sure everything works. That should be it!

This project is licensed under the MIT license with the exception of the PHP_Minify class, which didn’t specify in the class itself, but the project it’s included in, minify, is licensed under New BSD License so I would assume this class would fall under it as well.

I gladly accept any contributions to this project since I made it for my own personal use and I’m sharing it for the benefit of others who might also need it.
I don’t have much spare time to spend on it, so anyone wishing to improve it is gladly welcomed to do so.

Please report any issues on the project’s GitHub page, https://github.com/amereservant/ PHP -Minify . I know there’s a formatting glitch in Google Chrome regarding the footer blending in with the output details, but otherwise it seems to be fine in other browsers I’ve tested it in.

About

A PHP website interface for the YUI Compressor for minifying CSS and Javascript.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

License

matthiasmullie/minify

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns, such as:

  • @import url(«http://path») -> @import «http://path»
  • #ff0000 , #ff00ff -> red , #f0f
  • -0px , 50.00px -> 0 , 50px
  • bold -> 700
  • p <> -> removed

And it comes with a huge test suite.

use MatthiasMullie\Minify; $sourcePath = '/path/to/source/css/file.css'; $minifier = new Minify\CSS($sourcePath); // we can even add another file, they'll then be // joined in 1 output file $sourcePath2 = '/path/to/second/source/css/file.css'; $minifier->add($sourcePath2); // or we can just add plain CSS $css = 'body < color: #000000; >'; $minifier->add($css); // save minified file to disk $minifiedPath = '/path/to/minified/css/file.css'; $minifier->minify($minifiedPath); // or just output the content echo $minifier->minify();
// just look at the CSS example; it's exactly the same, but with the JS class & JS files :)

Available methods, for both CSS & JS minifier, are:

__construct(/* overload paths */)

The object constructor accepts 0, 1 or multiple paths of files, or even complete CSS/JS content, that should be minified. All CSS/JS passed along, will be combined into 1 minified file.

use MatthiasMullie\Minify; $minifier = new Minify\JS($path1, $path2);

This is roughly equivalent to the constructor.

$minifier->add($path3); $minifier->add($js);

This will minify the files’ content, save the result to $path and return the resulting content. If the $path parameter is omitted, the result will not be written anywhere.

CAUTION: If you have CSS with relative paths (to imports, images, . ), you should always specify a target path! Then those relative paths will be adjusted in accordance with the new path.

$minifier->minify('/target/path.js');

Minifies and optionally saves to a file, just like minify() , but it also gzencode() s the minified content.

setMaxImportSize($size) (CSS only)

The CSS minifier will automatically embed referenced files (like images, fonts, . ) into the minified CSS, so they don’t have to be fetched over multiple connections.

However, for really large files, it’s likely better to load them separately (as it would increase the CSS load time if they were included.)

This method allows the max size of files to import into the minified CSS to be set (in kB). The default size is 5.

$minifier->setMaxImportSize(10);

setImportExtensions($extensions) (CSS only)

The CSS minifier will automatically embed referenced files (like images, fonts, . ) into minified CSS, so they don’t have to be fetched over multiple connections.

This methods allows the type of files to be specified, along with their data:mime type.

The default embedded file types are gif, png, jpg, jpeg, svg, apng, avif, webp, woff and woff2.

$extensions = array( 'gif' => 'data:image/gif', 'png' => 'data:image/png', ); $minifier->setImportExtensions($extensions);

Simply add a dependency on matthiasmullie/minify to your composer.json file if you use Composer to manage the dependencies of your project:

composer require matthiasmullie/minify

Although it’s recommended to use Composer, you can actually include these files anyway you want.

About

CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

PhpMinify is a little tool to minify your application php like the javascript minify tools.

License

basselin/php-minify

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

PhpMinify is a little tool to minify your application php like the javascript minify tools. PhpMinify uses php_strip_whitespace() . The script compresses a source directory to a target directory.

require 'phpminify.php'; $phpMinify = new PhpMinify(array( 'source' => './', 'target' => './demo/', )); var_dump($phpMinify->run());
Key Description Type Default
source Source directory string ‘module/’
target Target directory string ‘modulemin/’
banner Banner comment for each php file

string »
extensions Extensions to minify array array(‘inc’, ‘php’, ‘phtml’)
exclusions Extensions to be ignored during the copy array array(‘md’)

About

PhpMinify is a little tool to minify your application php like the javascript minify tools.

Источник

Оцените статью