Skip to content

Commit cdacb8e

Browse files
committed
minify html
1 parent 9c9be4e commit cdacb8e

File tree

7 files changed

+27
-12
lines changed

7 files changed

+27
-12
lines changed

ghcjs/currency-converter/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ runApp app = do
5252
router js req =
5353
case Wai.pathInfo req of
5454
("static" : _) -> staticApp (defaultWebAppSettings ".") req
55+
("site.webmanifest" : _) -> staticApp (defaultWebAppSettings "static") req
5556
_ -> JS.jsaddleAppWithJs (JS.jsaddleJs False <> js) req
5657
#else
5758
runApp :: IO () -> IO ()
@@ -896,7 +897,7 @@ copyright =
896897
]
897898
[ Miso.text "\169 2024 Functora. All rights reserved. ",
898899
Miso.text "By continuing to use this software, you agree to the ",
899-
a_ [href_ "license.html"] [Miso.text "Terms and Conditions"],
900+
a_ [href_ "license.html"] [Miso.text "Terms of Service"],
900901
Miso.text " and ",
901902
a_ [href_ "privacy.html"] [Miso.text "Privacy Policy"],
902903
Miso.text ". ",

ghcjs/currency-converter/app.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: app
3-
version: 0.1.0.3
3+
version: 0.1.0.4
44
synopsis: First miso app
55
category: Web
66
build-type: Simple

ghcjs/currency-converter/default.nix

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ in rec {
2626
app = pkgs.haskell.packages.ghcjs86.callCabal2nix "app" ./. {};
2727
vsn = app.passthru.version;
2828
repo = builtins.toString ./.;
29+
app-serve-latest = functora-pkgs.writeShellApplication rec {
30+
name = "app-serve-latest";
31+
text = ''
32+
${functora-pkgs.simple-http-server}/bin/simple-http-server \
33+
-p 3000 ${repo}/dist/latest
34+
'';
35+
};
2936
app-release-latest = functora-pkgs.writeShellApplication rec {
3037
name = "app-release-latest";
3138
text = ''
@@ -67,12 +74,15 @@ in rec {
6774
mkdir -p $out/static
6875
cp ${./static}/*.png $out/static/
6976
cp ${./static}/*.woff2 $out/static/
70-
cp ${./static}/*.ico $out/
7177
cp ${./static}/*.webmanifest $out/
72-
cp ${readmeDer}/readme.html $out/
73-
cp ${licenseDer}/license.html $out/
74-
cp ${privacyDer}/privacy.html $out/
75-
echo '<!doctype html><html><head><script language="javascript" src="all.js"></script><link rel="stylesheet" href="static/all.css"/></head><body></body></html>' > $out/index.html
78+
cp ${./static}/*.ico $out/
79+
${functora-pkgs.html-minifier}/bin/html-minifier -o $out/license.html \
80+
${licenseDer}/license.html
81+
${functora-pkgs.html-minifier}/bin/html-minifier -o $out/privacy.html \
82+
${privacyDer}/privacy.html
83+
echo '<!doctype html><html lang="en"><head><script language="javascript" src="all.js" defer></script><link rel="stylesheet" href="static/all.css"/></head><body></body></html>' \
84+
| ${functora-pkgs.html-minifier}/bin/html-minifier \
85+
> $out/index.html
7686
${functora-pkgs.clean-css-cli}/bin/cleancss \
7787
-O2 \
7888
--source-map \
@@ -85,6 +95,7 @@ in rec {
8595
--compilation_level ADVANCED_OPTIMIZATIONS \
8696
--externs ${app}/bin/app.jsexe/all.js.externs \
8797
--externs ${./static}/material-components-web.min.js \
98+
--output_wrapper "%output%//# sourceMappingURL=all.js.map" \
8899
--create_source_map $out/all.js.map \
89100
--js ${app}/bin/app.jsexe/all.js \
90101
--js_output_file $out/all.js

ghcjs/currency-converter/shell.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ in
2222
buildInputs =
2323
[
2424
app-ghcid
25+
app-serve-latest
2526
app-publish-stable
2627
app-release-latest
2728
app-release-stable
@@ -31,6 +32,8 @@ in
3132
functora-pkgs.cabal-install
3233
functora-pkgs.closurecompiler
3334
functora-pkgs.clean-css-cli
35+
functora-pkgs.html-minifier
36+
functora-pkgs.simple-http-server
3437
]
3538
++ prev.buildInputs
3639
++ functora-tools;

ghcjs/currency-converter/static/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
patch(x3);
2727
var x4 = document.createElement("link");
2828
x4.rel = "manifest";
29-
x4.href = "static/site.webmanifest";
29+
x4.href = "site.webmanifest";
3030
patch(x4);
3131
})();

ghcjs/currency-converter/static/site.webmanifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"short_name": "Currency Converter",
44
"icons": [
55
{
6-
"src": "/android-chrome-192x192.png",
6+
"src": "static/android-chrome-192x192.png",
77
"sizes": "192x192",
88
"type": "image/png"
99
},
1010
{
11-
"src": "/android-chrome-512x512.png",
11+
"src": "static/android-chrome-512x512.png",
1212
"sizes": "512x512",
1313
"type": "image/png"
1414
}

ghcjs/currency-converter/trapeze.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
platforms:
22
android:
33
appName: Currency Converter
4-
versionCode: 4
5-
versionName: 0.1.0.3
4+
versionCode: 5
5+
versionName: 0.1.0.4
66
packageName: com.functora.currency_converter
77
manifest:
88
- file: AndroidManifest.xml

0 commit comments

Comments
 (0)