git clone 'git://github.com/crshd/mynt-mode.git'
Static site generators are all about simplicity - no complicated frameworks, no overhead through dynamically generating the page every time it's requested, and being able to work in your favorite environment for creating and posting content.
So why am I forced to constantly switch between my editor and (at least one) terminal? Until now, I've always fired up two terminals, one with
mynt watch to generate the site, another one with
mynt serve to be able to preview my writings. Not to mention having to load the virtualenv first…
There's got to be an easier way. Enter mynt-mode.
mynt-mode is a minor mode for everybody's (admit it) favorite editor. Edit, generate and preview without leaving Emacs. Create a new post with frontmatter with a single keybinding. Make static sites as simple as they're supposed to be.
mynt-mode doesn't depend on anything other than Emacs itself. But if you're using a virtualenv for mynt, you do need virtualenvwrapper.el.
The usual stuff. Drop mynt-mode.el in your load path and add
mynt-mode is (will soon be) available on MELPA.
M-x package-install<RET>mynt-mode<RET> to enlightenment!
mynt-mode has support for multiple mynt projects. You just have to define them before using them.
Let's assume you have a site living in
~/Sites/mynt, with the subdirs
production and using a virtualenv called “mynt”. And you have another one at
did. And just for good measure, the venv is called
hah-ha. This would look something like this:
'(("project1" . ((location . "~/Sites/mynt/")
(source . "source")
(destination . "production")
(venv . nil)))
("project2" . ((location . "~/www/lolblog/")
(source . "do")
(destination . "did")
(venv . "hah-ha")))))
Now you can switch between them with M-x mynt-pick-project. All further commands will act on this project only.
Note: By default, the first project defined is enabled.
mynt-mode keybindings start with C-c m. If you don't care about C-m for newline (I don't, I use C-j), and want to use it for mynt-mode instead:
(local-set-key (kbd "C-m g") 'mynt-generate)
(local-set-key (kbd "C-m w") 'mynt-watch)
(local-set-key (kbd "C-m s") 'mynt-serve)
(local-set-key (kbd "C-m p") 'mynt-make-post)))
Same scenario as above. As a bonus, this also makes sure that mynt-mode is installed, so you don't have to do that manually!
:bind (("C-m g" . mynt-generate)
("C-m w" . mynt-watch)
("C-m s" . mynt-serve)
("C-m p" . mynt-make-post))
:config (setq mynt-location "~/Sites/mynt/"
(Author's note: You (really, really) should use use-package.