mirror of
https://github.com/RGBCube/rgbcube.github.io
synced 2025-05-22 09:25:07 +00:00
Clean up minify functions
This commit is contained in:
parent
9336ad99b0
commit
80c8f36435
5 changed files with 26 additions and 17 deletions
|
@ -1,13 +1,13 @@
|
|||
const SPECIAL_CHARS: [char; 8] = ['{', '}', ':', ';', ' ', '\n', '!', '>'];
|
||||
|
||||
// Taken from https://github.com/amgarrett09/rust-css-minifier/blob/master/src/minify/mod.rs.
|
||||
pub fn css(input: &str) -> String {
|
||||
pub fn css<S: AsRef<str>>(input: S) -> String {
|
||||
let mut last_char: Vec<char> = " ".chars().collect();
|
||||
let mut output = Vec::new();
|
||||
|
||||
let mut inside_comment = false;
|
||||
|
||||
for c in input.chars() {
|
||||
for c in input.as_ref().chars() {
|
||||
// We're in a comment if we find '/*'
|
||||
if !inside_comment && c == '*' && last_char[0] == '/' {
|
||||
inside_comment = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue