Skip to content

Commit

Permalink
Fixed JShint warnings and minify HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
Aircoookie committed Dec 21, 2020
1 parent 2e2f7fa commit f7893d4
Show file tree
Hide file tree
Showing 6 changed files with 2,148 additions and 2,243 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

### Development versions after 0.11.1 release

#### Build 2012210

- Split index.htm in separate CSS + JS files (PR #1542)
- Minify UI HTML, saving >1.5kB flash
- Fixed JShint warnings

#### Build 2012180

- Boot brightness 0 will now use the brightness from preset
Expand Down
12 changes: 12 additions & 0 deletions tools/cdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function writeHtmlGzipped(sourceFile, resultFile) {
console.info("Reading " + sourceFile);
new inliner(sourceFile, function (error, html) {
console.info("Inlined " + html.length + " characters");
html = filter(html, "html-minify-ui");
console.info("Minified to " + html.length + " characters");

if (error) {
console.warn(error);
Expand Down Expand Up @@ -123,6 +125,16 @@ function filter(str, type) {
continueOnParseError: false,
removeComments: true,
});
} else if (type == "html-minify-ui") {
return MinifyHTML(str, {
collapseWhitespace: true,
conservativeCollapse: true,
maxLineLength: 80,
minifyCSS: true,
minifyJS: true,
continueOnParseError: false,
removeComments: true,
});
} else {
console.warn("Unknown filter: " + type);
return str;
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/index.htm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta charset="utf-8">
Expand Down
Loading

0 comments on commit f7893d4

Please sign in to comment.