I want to add functionality to javascript-mode so that, whenever I save a Javascript file on the current buffer, it creates a minified file of it in a directory defined with relative path such as ../foo with the same file name. How can I do that?
I am using Ubuntu as OS. Is there a good program that I should call in emacs for doing this?
You can add a function to the
after-save-hook, but make it specific to javascript mode, add the hook in thejs-mode-hook. Also, setadd-hook‘s fourth parameterLOCALto a non-nil value. For example: