Org: HTML, use compressed CSS

This commit is contained in:
TEC 2021-04-17 13:19:51 +08:00
parent afc4233c10
commit 882295ecde
Signed by: tec
GPG Key ID: 779591AFDB81F06C
5 changed files with 24 additions and 2 deletions

View File

@ -6789,7 +6789,7 @@ Suffice to say I've snatched it, with a few of my own tweaks applied.
"<script>\n"
(f-read-text (expand-file-name "misc/org-css/main.js" doom-private-dir))
"</script>\n<style>\n"
(f-read-text (expand-file-name "misc/org-css/main.css" doom-private-dir))
(f-read-text (expand-file-name "misc/org-css/main.min.css" doom-private-dir))
"</style>"))
(when org-fancy-html-export-mode
(setq org-html-style-default org-html-style-fancy)))

View File

@ -2,5 +2,5 @@
;;; For more information see (info "(emacs) Directory Variables")
((scss-mode . ((after-save-hook . (lambda ()
(shell-command-to-string "sassc main.scss main.css")
(shell-command "./build.sh")
(org-html-reload-fancy-style))))))

View File

@ -1,4 +1,5 @@
#+title: Pile Theme
#+property: header-args:shell :tangle build.sh :shebang "#!/usr/bin/env bash" :comments none
A sass-based set of styles to be used by Org when exporting to HTML.
=main.scss= is compiled to =main.css= which is then inserted into the ~<head>~ of
@ -17,6 +18,14 @@ To build =main.css= and =main.js=, I simply run
sassc main.scss main.css
#+end_src
A minified CSS file would be nice to have too.
#+begin_src shell
sassc --style compressed main.scss main.min.css
if command -v csso &> /dev/null; then
csso main.min.css -o main.min.css
fi
#+end_src
Then for combining the JS
#+begin_src shell

9
misc/org-css/build.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
sassc main.scss main.css
sassc --style compressed main.scss main.min.css
if command -v csso &> /dev/null; then
csso main.min.css -o main.min.css
fi
ls _*.js | sort -V | xargs cat > main.js

4
misc/org-css/main.min.css vendored Normal file

File diff suppressed because one or more lines are too long