]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Minify/extlib/minify/min/README.txt
a7cf774a18fd8eb4a33cccc2482f2566e5894280
[quix0rs-gnu-social.git] / plugins / Minify / extlib / minify / min / README.txt
1 The files in this directory represent the default Minify setup designed to ease
2 integration with your site. This app will combine and minify your Javascript or
3 CSS files and serve them with HTTP compression and cache headers.
4
5
6 RECOMMENDED
7
8 It's recommended to edit config.php to set $min_cachePath to a writeable
9 (by PHP) directory on your system. This will improve performance.
10
11
12 GETTING STARTED
13
14 The quickest way to get started is to use the Minify URI Builder application
15 on your website: http://example.com/min/builder/
16
17
18 MINIFYING A SINGLE FILE
19
20 Let's say you want to serve this file:
21   http://example.com/wp-content/themes/default/default.css
22
23 Here's the "Minify URL" for this file:
24   http://example.com/min/?f=wp-content/themes/default/default.css
25
26 In other words, the "f" argument is set to the file path from root without the 
27 initial "/". As CSS files may contain relative URIs, Minify will automatically
28 "fix" these by rewriting them as root relative.
29
30
31 COMBINING MULTIPLE FILES IN ONE DOWNLOAD
32
33 Separate the paths given to "f" with commas.
34
35 Let's say you have CSS files at these URLs:
36   http://example.com/scripts/jquery-1.2.6.js
37   http://example.com/scripts/site.js
38
39 You can combine these files through Minify by requesting this URL:
40   http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js
41
42
43 SIMPLIFYING URLS WITH A BASE PATH
44
45 If you're combining files that share the same ancestor directory, you can use
46 the "b" argument to set the base directory for the "f" argument. Do not include
47 the leading or trailing "/" characters.
48
49 E.g., the following URLs will serve the exact same content:
50   http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js,scripts/home.js
51   http://example.com/min/?b=scripts&f=jquery-1.2.6.js,site.js,home.js
52
53
54 MINIFY URLS IN HTML
55
56 In (X)HTML files, don't forget to replace any "&" characters with "&".
57
58
59 SPECIFYING ALLOWED DIRECTORIES
60
61 By default, Minify will serve any *.css/*.js files within the DOCUMENT_ROOT. If
62 you'd prefer to limit Minify's access to certain directories, set the 
63 $min_serveOptions['minApp']['allowDirs'] array in config.php. E.g. to limit 
64 to the /js and /themes/default directories, use:
65
66 $min_serveOptions['minApp']['allowDirs'] = array('//js', '//themes/default');
67
68
69 GROUPS: FASTER PERFORMANCE AND BETTER URLS
70
71 For the best performance, edit groupsConfig.php to pre-specify groups of files 
72 to be combined under preset keys. E.g., here's an example configuration in 
73 groupsConfig.php:
74
75 return array(\r
76     'js' => array('//js/Class.js', '//js/email.js')\r
77 );
78
79 This pre-selects the following files to be combined under the key "js":
80   http://example.com/js/Class.js
81   http://example.com/js/email.js
82   
83 You can now serve these files with this simple URL:
84   http://example.com/min/?g=js
85   
86
87 GROUPS: SPECIFYING FILES OUTSIDE THE DOC_ROOT
88
89 In the groupsConfig.php array, the "//" in the file paths is a shortcut for
90 the DOCUMENT_ROOT, but you can also specify paths from the root of the filesystem
91 or relative to the DOC_ROOT: 
92
93 return array(
94     'js' => array(
95         '//js/file.js'            // file within DOC_ROOT
96         ,'//../file.js'           // file in parent directory of DOC_ROOT
97         ,'C:/Users/Steve/file.js' // file anywhere on filesystem
98     )
99 );
100
101
102 FAR-FUTURE EXPIRES HEADERS
103
104 Minify can send far-future (one year) Expires headers. To enable this you must
105 add a number to the querystring (e.g. /min/?g=js&1234 or /min/f=file.js&1234) 
106 and alter it whenever a source file is changed. If you have a build process you 
107 can use a build/source control revision number.
108
109 If you serve files as a group, you can use the utility function Minify_groupUri()
110 to get a "versioned" Minify URI for use in your HTML. E.g.:
111
112 <?php
113 // add /min/lib to your include_path first!
114 require $_SERVER['DOCUMENT_ROOT'] . '/min/utils.php';
115
116 $jsUri = Minify_groupUri('js'); 
117 echo "<script type='text/javascript' src='{$jsUri}'></script>";
118
119
120 DEBUG MODE
121
122 In debug mode, instead of compressing files, Minify sends combined files with
123 comments prepended to each line to show the line number in the original source
124 file. To enable this, set $min_allowDebugFlag to true in config.php and append
125 "&debug=1" to your URIs. E.g. /min/?f=script1.js,script2.js&debug=1
126
127 Known issue: files with comment-like strings/regexps can cause problems in this mode.
128
129
130 QUESTIONS?
131
132 http://groups.google.com/group/minify