├── .gitignore
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── html-minify-options.php
├── html-minify-process.php
└── html-minify.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | I'm delighted that you're helping make this open source project better. Here are a few quick guidelines to make this an easier and better process for everyone.
4 |
5 | ## Reporting a bug
6 |
7 | First, **make sure the bug hasn't already been reported** by searching GitHub's issues section.
8 |
9 | If no existing issue exists, go ahead and create one. **Please be sure to include all of the following:**
10 |
11 | 1. A clear, descriptive title (ie. "A bug" is *not* a good title).
12 | 2. [A reduced test case.](https://css-tricks.com/reduced-test-cases/) In order to debug code issues, I need to see actual code in a browser.
13 | 3. The browser and OS that you're using.
14 |
15 | ## Asking a question
16 |
17 | Before asking, please **make sure the question hasn't already been asked** by searching GitHub's issues section.
18 |
19 | ## Submitting a Pull Request
20 |
21 | Please make sure your code meets the following code standards:
22 |
23 | - Camel case for JavaScript variables.
24 | - [Object-Oriented CSS](http://www.slideshare.net/stubbornella/object-oriented-css) for CSS selectors.
25 | - Favor readable code over brevity. The build process will reduce size, so opt for readability. (ex. `var navigation` is better than `var n`)
26 | - Order CSS properties alphabetically.
27 | - Hard tabs.
28 |
29 | Before submitting, make sure that you've:
30 |
31 | - Updated the version number using semantic versioning.
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # The MIT License (MIT)
2 |
3 | Copyright (c) Go Make Things, LLC
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HTML Minify
2 | HTML Minify is a plugin for WordPress that compresses the HTML output to reduce file size and improve performance. It's forked from a [script by DVS](http://www.intert3chmedia.net/2011/12/minify-html-javascript-css-without.html).
3 |
4 | [Download HTML Minify](https://github.com/cferdinandi/html-minify/archive/master.zip)
5 |
6 |
7 |
8 | ## Getting Started
9 |
10 | Getting started with HTML Minify is as simple as installing a plugin:
11 |
12 | 1. Upload the `html-minify` folder to the `/wp-content/plugins/` directory.
13 | 2. Activate the plugin through the Plugins menu in WordPress.
14 |
15 | And that's it, you're done. Nice work! You change what gets minified under "Settings" in the Admin Dashboard.
16 |
17 | It's recommended that you also install the [GitHub Updater plugin](https://github.com/afragen/github-updater) to get automattic updates.
18 |
19 |
20 |
21 | ## Known Issues
22 |
23 | It's been reported that [data URIs](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs) may [break the minifier](https://github.com/cferdinandi/html-minify/issues/2). This has not been consistently duplicated, nor is their a fix available, but is something to be aware of.
24 |
25 |
26 |
27 | ## How to Contribute
28 |
29 | Please read the [Contribution Guidelines](CONTRIBUTING.md).
30 |
31 |
32 |
33 | ## License
34 |
35 | The code is available under the [MIT License](LICENSE.md).
--------------------------------------------------------------------------------
/html-minify-options.php:
--------------------------------------------------------------------------------
1 |
28 |
32 |
33 |
37 |
38 |
42 | 'off',
58 | 'ignore_comments' => 'off',
59 | 'exclude_info' => 'off',
60 | );
61 |
62 | $defaults = apply_filters( 'html_minify_default_theme_options', $defaults );
63 |
64 | $options = wp_parse_args( $saved, $defaults );
65 | $options = array_intersect_key( $options, $defaults );
66 |
67 | return $options;
68 | }
69 |
70 | // Sanitize and validate updated theme options
71 | function html_minify_theme_options_validate( $input ) {
72 | $output = array();
73 |
74 | if ( isset( $input['ignore_css'] ) )
75 | $output['ignore_css'] = 'on';
76 |
77 | if ( isset( $input['ignore_comments'] ) )
78 | $output['ignore_comments'] = 'on';
79 |
80 | if ( isset( $input['exclude_info'] ) )
81 | $output['exclude_info'] = 'on';
82 |
83 | return apply_filters( 'html_minify_theme_options_validate', $output, $input );
84 | }
85 |
86 |
87 |
88 | /**
89 | * Theme Options Menu
90 | * Each option field requires its own add_settings_field function.
91 | */
92 |
93 | // Create theme options menu
94 | // The content that's rendered on the menu page.
95 | function html_minify_theme_options_render_page() {
96 | ?>
97 |