minify/lib.rs
1//! Minification tool for html and json
2//!
3//! # Usage
4//!
5//! First add the library to the dependencies of your project like this:
6//!
7//! ```toml
8//! [dependencies]
9//! minify = "1.2"
10//! ```
11//!
12//! Afterwards you can import the library like this:
13//!
14//! ```rust
15//! extern crate minify;
16//! ```
17//!
18//! # Minify Html
19//!
20//! The following rules are applied for html minification:
21//!
22//! * Removal of ascii control characters
23//! * Removal of comments
24//! * Removal of multiple whitespaces
25//! * Removal of whitespaces before and after greater-than and less-than signs
26//! * `_<_html_>_` => `<html>`
27//!
28//! ```rust
29//! extern crate minify;
30//! use minify::html::minify;
31//!
32//! fn main() {
33//! let html = r#"
34//! <html>
35//! <head>
36//! </head>
37//! <body>
38//! </body>
39//! <html>
40//! "#;
41//! let html_minified = minify(html);
42//! }
43//! ```
44//!
45//! # Minify JSON
46//!
47//! The following rules are applied for json minification:
48//!
49//! * Removal of ascii control characters
50//! * Removal of whitespaces outside of strings
51//!
52//! ```rust
53//! extern crate minify;
54//! use minify::json::minify;
55//!
56//! fn main() {
57//! let json = r#"
58//! {
59//! "test": "test",
60//! "test2": 2
61//! }
62//! "#;
63//! let json_minified = minify(json);
64//! }
65//! ```
66
67#![warn(
68 absolute_paths_not_starting_with_crate,
69 anonymous_parameters,
70 box_pointers,
71 confusable_idents,
72 deprecated_in_future,
73 // elided_lifetimes_in_paths,
74 explicit_outlives_requirements,
75 indirect_structural_match,
76 keyword_idents,
77 macro_use_extern_crate,
78 meta_variable_misuse,
79 missing_copy_implementations,
80 missing_debug_implementations,
81 missing_docs,
82 non_ascii_idents,
83 single_use_lifetimes,
84 trivial_casts,
85 trivial_numeric_casts,
86 unaligned_references,
87 // unreachable_pub,
88 unsafe_code,
89 unstable_features,
90 unused_crate_dependencies,
91 unused_extern_crates,
92 unused_import_braces,
93 unused_lifetimes,
94 unused_qualifications,
95 unused_results,
96 variant_size_differences
97)]
98#![warn(
99 clippy::cargo,
100 clippy::complexity,
101 clippy::correctness,
102 clippy::nursery,
103 clippy::pedantic,
104 clippy::perf,
105 clippy::style
106)]
107#![allow(
108 clippy::implicit_return,
109 clippy::shadow_unrelated,
110 clippy::struct_excessive_bools,
111 clippy::module_name_repetitions,
112 clippy::match_wildcard_for_single_variants
113)]
114
115/// Minification for html content
116pub mod html;
117mod io;
118/// Minifigation for json content
119pub mod json;