Comments (6)
The one in server.clj
is for when you're editing (lein ring server
) and the one in the -main
is for lein run
(ie. Compiling once for deployment). Hope that clears things up!
from cryogen-core.
This should help :) You can do what you suggested to read in a different config and then pass that to compile-assets-timed
from cryogen-core.
So one thing that's unclear, do I need to modify them both? Or is modifying the src/cryogen/server.clj
for when I'm editing, and modifying the src/cryogen/core.clj
for stuff that always runs?
from cryogen-core.
It might be worthwhile mentioning that in the docs? 🤷 Thanks a ton for the help =)...
from cryogen-core.
Managed to figure out a decent enough solution, documented here if anyone else wants do this =)...
In project.clj
:
(defproject cryogen "0.1.0"
:description "Simple static site generator"
:url "https://github.com/lacarmen/cryogen"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [...
[environ "1.1.0"]] ;; <-- added in environ
:plugins [[lein-ring "0.12.5"]
[lein-environ "1.1.0"]] ;; <-- + the lein plugin
:main cryogen.core
:ring {:init cryogen.server/init
:handler cryogen.server/handler}
:aliases {"preview" ["ring" "server-headless"] ;; <-- defined some preview/writing aliases
"write" ["with-profile" "write" "ring" "server-headless"]}
:profiles {:write {:env {:config-path "content/drafting.edn"}}})
In src/cryogen/server.clj
, mainly adjusted init
:
(ns cryogen.server
(:require
...
[environ.core :refer [env]]))
(defn init []
(load-plugins)
(let [custom-config-path (env :config-path)
config-override (fn [] (when custom-config-path (read-string (slurp custom-config-path))))
compile-assets-timed-fn (if config-override
(comp compile-assets-timed config-override)
compile-assets-timed)]
(compile-assets-timed-fn)
(let [ignored-files (-> (resolve-config) :ignored-files)]
(start-watcher! "content" ignored-files compile-assets-timed-fn)
(start-watcher! "themes" ignored-files compile-assets-timed-fn))))
This maintains the pleasant property that editing the supplied config while the server is running content/drafting.edn
in this case, reloads the config =)...
Works great, thanks!
from cryogen-core.
Nice! Glad you found a solution :)
from cryogen-core.
Related Issues (20)
- Change in clean-urls behaviour HOT 7
- Relax config schema
- Centred blue theme inconsistency HOT 1
- Changing `:public-dest` seems to break CSS/JS access HOT 6
- Compass is unmaintained since 2016 HOT 1
- Provide :preview-plaintext to every post, page for SEO HOT 1
- Provide an option to drop the date from file names HOT 2
- Should be able to configure the class on generated toc's HOT 1
- Proposal: Replace :content with :content-dom HOT 3
- An exception in compile-assets-timed should fail the build HOT 2
- Bug: cannot set a page as homepage HOT 1
- Tags with special characters get a broken tag-output page. Like tag C# HOT 2
- <!-more-> marker characters HOT 5
- Adding `:posts` and `:pages` to params via :extend-params-fn does not behave as expected HOT 3
- Make :posts and :pages available in all posts and pages by default HOT 1
- Making css processing a plugin HOT 1
- Proposed enhancement: Automatically generate post metadata from plain markdown file HOT 9
- It would be nice to omit pages from prev/next if :page-index nil HOT 8
- Add header block for Google's 'Rich Snippets' nonsense HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cryogen-core.