Skip to content

Commit 9c9be4e

Browse files
committed
bundle and optimize with clean-css
1 parent 62fb449 commit 9c9be4e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

ghcjs/currency-converter/Main.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,13 +459,17 @@ getQuoteMoneyOptic = \case
459459

460460
viewModel :: Model -> View Action
461461
viewModel st =
462+
#ifndef __GHCJS__
462463
div_
463464
mempty
464465
[ link_ [rel_ "stylesheet", href_ "static/material-components-web.min.css"],
465466
link_ [rel_ "stylesheet", href_ "static/material-icons.css"],
466467
link_ [rel_ "stylesheet", href_ "static/app.css"],
467468
mainWidget st
468469
]
470+
#else
471+
mainWidget st
472+
#endif
469473

470474
mainWidget :: Model -> View Action
471475
mainWidget st =
@@ -514,9 +518,7 @@ amountWidget st loc =
514518
[ TextField.outlined
515519
$ TextField.config
516520
& TextField.setType (Just "number")
517-
& TextField.setValid valid
518521
& TextField.setOnInput onInputAction
519-
& TextField.setRequired True
520522
& TextField.setLeadingIcon
521523
( Just
522524
$ TextField.icon

ghcjs/currency-converter/default.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,26 @@ in rec {
6666
installPhase = ''
6767
mkdir -p $out/static
6868
cp ${./static}/*.png $out/static/
69-
cp ${./static}/*.css $out/static/
7069
cp ${./static}/*.woff2 $out/static/
7170
cp ${./static}/*.ico $out/
7271
cp ${./static}/*.webmanifest $out/
7372
cp ${readmeDer}/readme.html $out/
7473
cp ${licenseDer}/license.html $out/
7574
cp ${privacyDer}/privacy.html $out/
76-
echo '<!doctype html><html><head><script language="javascript" src="all.js"></script></head><body></body></html>' > $out/index.html
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
76+
${functora-pkgs.clean-css-cli}/bin/cleancss \
77+
-O2 \
78+
--source-map \
79+
-o $out/static/all.css \
80+
${./static}/material-components-web.min.css \
81+
${./static}/material-icons.css \
82+
${./static}/app.css
7783
${functora-pkgs.closurecompiler}/bin/closure-compiler \
7884
--jscomp_off=checkVars \
7985
--compilation_level ADVANCED_OPTIMIZATIONS \
8086
--externs ${app}/bin/app.jsexe/all.js.externs \
8187
--externs ${./static}/material-components-web.min.js \
82-
--externs ${./static}/material-components-web-elm.min.js \
88+
--create_source_map $out/all.js.map \
8389
--js ${app}/bin/app.jsexe/all.js \
8490
--js_output_file $out/all.js
8591
'';

ghcjs/currency-converter/shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ in
3030
app-release-license
3131
functora-pkgs.cabal-install
3232
functora-pkgs.closurecompiler
33+
functora-pkgs.clean-css-cli
3334
]
3435
++ prev.buildInputs
3536
++ functora-tools;

0 commit comments

Comments
 (0)