This is part of the Emacs Starter Kit.
Java-script Helpers
(setq install-packages (list 'js2-mode
'css-mode
'mouse-slider-mode
'web-mode
;;'ng2-mode
'skewer-mode
'simple-httpd))
(dolist (package install-packages) (package-install package))
(autoload 'js2-mode "js2-mode" "Start js2-mode" t)
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
(add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-hook 'js2-mode-hook 'run-coding-hook)
(add-hook 'web-mode-hook 'run-coding-hook)
(add-hook 'css-mode-hook 'run-coding-hook)
(require 'simple-httpd)
(require 'skewer-mode)
(require 'skewer-repl)
(require 'skewer-html)
(require 'skewer-css)
(defun skewer-start ()
(interactive)
(let ((httpd-port 8023))
(httpd-start)
(message "Ready to skewer the browser. Now jack in with the bookmarklet.")))
(defun skewer-demo ()
(interactive)
(let ((httpd-port 8024))
(run-skewer)
(skewer-repl)))
(require 'mouse-slider-mode)
(add-to-list 'mouse-slider-mode-eval-funcs
'(js2-mode . skewer-eval-defun))
(provide 'setup-skewer)
;;(setq httpd-root "/var/www")
(add-hook 'js2-mode-hook 'skewer-mode)
(add-hook 'css-mode-hook 'skewer-css-mode)
(add-hook 'html-mode-hook 'skewer-html-mode)
(add-hook 'js2-mode-hook
'(lambda ()
(company-mode)
(my-personal-code-style 2)
(flycheck-mode t)
(setq flycheck-jshintrc "~/.emacs.d/.jshintrc")
(setq-default js2-allow-rhino-new-expr-initializer nil)
(setq-default js2-auto-indent-p nil)
(setq-default js2-enter-indents-newline nil)
(setq-default js2-global-externs '("module" "require" "buster" "sinon" "assert" "refute" "setTimeout" "clearTimeout" "setInterval" "clearInterval" "location" "__dirname" "console" "JSON"))
(setq-default js2-idle-timer-delay 0.1)
(setq-default js2-indent-on-enter-key nil)
(setq-default js2-mirror-mode nil)
(setq-default js2-strict-inconsistent-return-warning nil)
(setq-default js2-auto-indent-p t)
(setq-default js2-include-rhino-externs nil)
(setq-default js2-include-gears-externs nil)
(setq-default js2-concat-multiline-strings 'eol)
(setq-default js2-rebind-eol-bol-keys nil)
))
(message "------ Starter Kit Web loaded ------")