Minify compresses JS and CSS_html/css_WEB-ITnose
Minify compresses and reduces CSS and JS (Minify: removes spaces, carriage returns, etc.), and integrates multiple CSS and JS files into one file. Don't think that your large bandwidth doesn't warrant this kind of optimization. The more important reason for using it is file merging, not compression, but file consolidation, which can reduce the browser side from constantly issuing new connection requests. Just like an FTP server, multiple small files and one large file are time-consuming. Not the same.
Minify is written in PHP, project address http://code.google.com/p/minify/
Installation
1. Download the latest Minify then extracts it to the minify directory.
2. Copy the "min" directory to your DOCUMENT_ROOT.
Basic usage
Assume you have http://localhost/a.js, http://localhost /b.js two files. So now, you can use http://localhost/min/?f=a.js,b.js and see if the browser returns the result. Is it the content of the two js files of minify?
Attached is the README.txt in the min directory
Reference
The files in this directory contain default Minify settings, designed to simplify integrating your website. Minify will merge minified JavaScript or CSS files and perform HTTP compression and caching headers.
Recommended
It is recommended to modify config.php to set $min_cachePath to a PHP writable directory. This will improve performance.
GETTING STARTED
The fastest way to get started with Minify is to visit your website using the URI of the Minify Builder application: http://example.com/min/ builder/
Compress a single file For example, you want to serve this file:
http://example.com/wp-content/themes/default/default .css
Here is the "Minify URL" of the file:
http://example.com/min/?f=wp-content/themes/default/default.css
In other words , the "f" parameter is set to the target file from the WEB root path (no need for path /)". Since CSS files may contain relative URIs, Minify will automatically find them through the rewriting mechanism.
Merge multiple files into one file for download Separate each file name of the f parameter with ','
For example, there is the following CSS file:
http://example.com/scripts/ jquery-1.2.6.js
http://example.com/scripts/site.js
You can combine it with Minify:
http://example.com/min/?f=scripts /jquery-1.2.6.js,scripts/site.js
Simplified base path If the files you merge share the same parent directory, you can use the f parameter set by b The basic directory of parameters (also excluding leading or suffix / characters).
For example, the following two ways of writing have the same effect:
http://example.com/min/?f=scripts/jquery-1.2.6 .js,scripts/site.js,scripts/home.js
http://example.com/min/?b=scripts&f=jquery-1.2.6.js,site.js,home.js
Use MINIFY in Html In (X)HTML files, don’t forget to replace & with &
Specify allowed directories By default, Minify will not have any *.css/*.js files in the DOCUMENT_ROOT scope. If you want to restrict Minify's access to certain directories, set the
$min_serveOptions ['minApp'] ['allowDirs'] array in config.php. For example: to limit to /js and /themes/default directories, use:
Php code
- $min_serveOptions['minApp'][' allowDirs'] = array('//js', '//themes/default');
"Group": faster performance and better URL For best performance, edit the pre-specified file groups in groupsConfig.php, here is an example configuration:
Php code
- return array(
- 'js' => array('//js/Class.js', '//js/email.js')
- );
The result of the above pre-specified js is to merge the following files:
http://example.com/js/Class.js
http://example.com/js/email.js
Now, you can simplify the URL like this:
http://example.com/min/?g=js
Group: Specify files outside the document_root directory
in groupsConfig In the .php array, // points to DOCUMENT_ROOT, but you can also specify an absolute directory path from the system or a relative directory relative to document_root:
Php code
- return array(
- 'js' => array(
- '//js/file.js' // file within DOC_ROOT
- , '//../file.js' // file in parent directory of DOC_ROOT
- ,'C:/Users/Steve/file.js' // file anywhere on filesystem
- )
- );
Future Expiration HTTP header
Minify can send future (one year) Expiration HTTP header. To enable this feature, you must add a number to URIs (e.g. /min/?g=js&1234 or /min/f=file.js&1234) and change the number whenever the source file is modified. If you use SVN/CVS, you might consider using the revision number as this number.
If you use "group" to merge and compress your files, you can use the tool function Minify_groupUri() to get a "version" URI. For example:
Php code
- // Before making sure the min/lib directory is set to include_path
- // add /min/lib to your include_path first!
- require $_SERVER['DOCUMENT_ROOT'] . '/min/utils.php';
- $jsUri = Minify_groupUri('js');
- echo "";
Debug mode
In debug mode, Minify does not compress the file, but sends the merged file with line numbers. To enable this mode, set $min_allowDebugFlag to true in config.php and add "&debug=1" to your URIs.
For example: /min/?f=script1.js,script2.js&debug=1
Note: Comment-style string regular expressions may cause problems for this pattern.
For more questions, please visit http://groups.google.com/group/minify

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text
