:;exec cask emacs --no-site-file --no-site-lisp --batch -L ./ -l "$0" -f main "$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)" "$@" ;;; build.el --- The build script of my personal website ;;; Version: 0.1.0 ;;; Package-Version 0.1.0 ;;; Commentary: ;;; Code: (require 'org) (require 'ox-html) (require 'ox-publish) (require 'dracula-theme) (require 'lisp/ox-template) (setq debug-on-error t) (defvar author-name "Sameer Rahmani" "Set this variable to your fullname.") (defvar author-email "lxsameer@gmail.com" "Set this varibale to your email address.") (defvar project-root nil "Root directory of the website source code.") (defun from-root (path) "Return the full path of the given PATH in the project root." (concat project-root path)) (defun prod-p () "Return non-nil if we're in development mode." (when (getenv "LXHOME_PROD") t)) (defun extra-headers () "Retun a list of extra header html tags." (concat "")) (defun main () "The entry point to the build script." ;; Setup the emacs theme so htmlize can actually setup ;; the code highlighter (load-theme 'dracula t) (enable-theme 'dracula) (setq project-root (car command-line-args-left)) (setf user-full-name author-name) (setf user-mail-address author-email) ;; Disable default header links (top, next) (setf org-html-home/up-format "") (setf org-html-link-up "") (setf org-html-link-home "") (setf org-html-scripts "") (let ((html-build-dir (from-root "/build/html/"))) (setq org-publish-project-alist `(("lxsameer.com" :base-directory ,(from-root "/orgs") :root-directory ,project-root :recursive t :base-extension "org" :publishing-directory ,(from-root "/build/html") ;; Exclude the blog archive index autogenerated below ;; Note that the regexp is relative to :base-directory ;; :exclude "^index.org" :section-numbers nil :with-toc nil :with-date nil :base-url ,(if (prod-p) "https://lxsameer.com" "http://localhost:3003") :html-head-extra ,(extra-headers) :html-template ,(from-root "/templates/blog.html") :html-headline-template ,(from-root "/templates/tags.html") :publishing-function org-html-publish-to-templated-html :auto-sitemap t :htmlized-source t :sitemap-folders ignore :sitemap-style list :sitemap-title "lxsameer's nest" :sitemap-filename "sitemap.inc" :sitemap-sort-files anti-chronologically) ("org->html" :base-directory ,(from-root "/orgs") :base-extension "org" :publishing-directory ,html-build-dir :recursive t :publishing-function org-html-publish-to-html :headline-levels 4 ;; :html-preamble ,(use-html "templates/header.html") ;; :html-postamble ,(use-html "templates/footer.html") :html-link-home "/" :html-head-include-default-style nil :html-head-include-scripts nil :html-head-extra ,(extra-headers) :makeindex nil) ("statics" :base-directory ,project-root :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|svg" :publishing-directory ,html-build-dir :recursive t :publishing-function org-publish-attachment) ("build" :components ("lxsameer.com" "statics"))))) (org-publish-project "build" t nil) (message "Build complete.")) (provide 'build) ;; Local Variables: ;; mode: emacs-lisp ;; End: ;;; build.el ends here