Grunt is a renowned JavaScript task runner. This package provides a way to invoke grunt tasks without needing a separate shell or buffer management per task or project.
Use MELPA: M-x package-install <RET> grunt <RET>
. Or, get grunt.el
in your load-path and do a (require 'grunt)
.
Figure out what keybinding you'd like to bind grunt-exec
to, or just
invoke it via M-x
while your current buffer is in a repo with a
Gruntfile somewhere.
;; I'm currently experimenting with "C-M-g"
(global-set-key (kbd "C-M-g") 'grunt-exec)
It'll try to find a Gruntfile by traversing upwards from your current
working directory, or bail out if it can't find one. Upon finding a
Gruntfile, grunt.el
will shell out to execute grunt --help
and
parse the available tasks from its output, suggesting the tasks it
finds there.
You can also enter in any valid Grunt task at the prompt.
After invoking a grunt task, we'll pop a window and buffer for you. While in that window, you have the following keybinds:
-
q: invoke
(quit-window)
, quitting the current window and burying its buffer. Note that since the buffer is buried and not killed, the grunt task will still continue running. For example, you could q away a long running window likegrunt watch
. -
g: rerun that buffer's Grunt task.
-
v1.1.0: If you happened to install this specific 1.1.0 version during the short period it was available, we may have accidentally overriden your q key in all shells to
(quit-window)
. This is obviously undesirable; execute the following elisp when in a shell via C-x C-e or M-: to restore functionality. Sorry 'bout that one! This bug is fixed in v1.1.1 and newer.(local-set-key (kbd "q") 'self-insert-command)
-
v1.0.0: We now default to using
grunt --help
to establish our task list. This is not the same behavior as in previous versions; see C-h vgrunt-show-all-tasks
for more information. For the old behavior,(setq grunt-show-all-tasks nil)
-
v0.0.3: If you have a long running task like
serve
orwatch
, you can re-run it fromgrunt-exec
and we'll automatically kill your existing process buffer before starting a new process. This is not the same behavior as in previous versions; see C-h vgrunt-kill-existing-buffer
for more information. For the old behavior,(setq grunt-kill-existing-buffer nil)
To run tests, use Cask:
$ cask install
$ cask exec ert-runner
In addition to grunt.el
's dependency on dash.el
, running tests
requires f.el
and noflet.el
; cask install
handles that for you.