0

如何配置 project.clj 文件以将其配置为在编译时从打嗝和花园输出 html 和 css 文件,以便我可以部署到服务器而无需在客户端加载任何动态 css/html?

4

2 回答 2

1

您可以使用lein-gardenleiningen 插件: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

为了帮助您将来找到类似的东西,我将描述一个发现过程。

我通过访问gardengithub 存储库 ( https://github.com/noprompt/garden ) 并查看代码中的一些看起来是独一无二的文本找到了这一点,garden以便我可以搜索所有 github 并找到其他使用garden. 我选择的文字是defpseudoelement. 我扫描了已经在使用的项目,发现自述文件garden中提到了正在运行的项目。lein garden auto再次搜索lein garden auto将我带到了lein-gardenleiningen 插件。事后看来,看看作者garden写的其他库可能更有意义。那将直接将我们带到插件。这就是生活。

于 2020-01-22T12:50:59.497 回答
1

如果您真的不需要使用 Leiningen,使用 Boot 您可以使用perun.io轻松完成,特别是如果网站是主要目标:

https://perun.io/guides/getting-started/

https://github.com/hashobject/perun

我以这种方式重写了我的网站https://github.com/ArchieT/website-archiet

如果有需要使用 Lein,也许我会稍后再看,因为我现在没有太多时间。

应该不难做到。

于 2017-07-07T21:11:00.973 回答