如何配置 project.clj 文件以将其配置为在编译时从打嗝和花园输出 html 和 css 文件,以便我可以部署到服务器而无需在客户端加载任何动态 css/html?
2 回答
您可以使用lein-garden
leiningen 插件:https ://github.com/noprompt/lein-garden 。
这是一个示例配置。
(defproject cash-money "1.1.1"
:plugins [[lein-garden "X.X.X"]]
:garden {:builds [{;; Optional name of the build:
:id "screen"
;; Source paths where the stylesheet source code is
:source-paths ["src/styles"]
;; The var containing your stylesheet:
:stylesheet cash-money.core/screen
;; Compiler flags passed to `garden.core/css`:
:compiler {;; Where to save the file:
:output-to "resources/screen.css"
;; Compress the output?
:pretty-print? false}}]})
然后您可以运行lein garden auto
以观察更改并自动重新编译。
如果您想要使用此代码库的示例:https ://github.com/Dexterminator/spotify-data-extrapolator/tree/db8d6e16529940272409598c8ac0fdbbaf739646
为了帮助您将来找到类似的东西,我将描述一个发现过程。
我通过访问garden
github 存储库 ( https://github.com/noprompt/garden ) 并查看代码中的一些看起来是独一无二的文本找到了这一点,garden
以便我可以搜索所有 github 并找到其他使用garden
. 我选择的文字是defpseudoelement
. 我扫描了已经在使用的项目,发现自述文件garden
中提到了正在运行的项目。lein garden auto
再次搜索lein garden auto
将我带到了lein-garden
leiningen 插件。事后看来,看看作者garden
写的其他库可能更有意义。那将直接将我们带到插件。这就是生活。
如果您真的不需要使用 Leiningen,使用 Boot 您可以使用perun.io轻松完成,特别是如果网站是主要目标:
https://perun.io/guides/getting-started/
https://github.com/hashobject/perun。
我以这种方式重写了我的网站https://github.com/ArchieT/website-archiet。
如果有需要使用 Lein,也许我会稍后再看,因为我现在没有太多时间。
应该不难做到。