1

I wish to setup a web dev environment with emacs, I search it and some post looks like a little bit old. I do not want it very professional but basic web dev is enough such as edit javascript and update output to browser, and see debug console from browser etc.

Any simple setup for basic web dev?

lucky1928
  • 1,666
  • 10
  • 28

1 Answers1

2

Install skewer-mode and js2-mode, then following below work flow:

  1. Add below config into init.el:
    (add-hook 'js2-mode-hook 'skewer-mode)
    (add-hook 'css-mode-hook 'skewer-css-mode)
    (add-hook 'html-mode-hook 'skewer-html-mode)
    (require 'simple-httpd)
    ;; set root folder for httpd server
    (setq httpd-root default-directory)
  1. Start Emacs from one directory, say /home/user/demo.

  2. Create index.html and script.js. index.html must include below line to communicate with Chrome: <script src="/skewer"></script>

  3. Open Emacs with script.js, then run M-x httpd-start to start HTTP server

  4. Open Chrome with URL http://localhost:8080/index.html, then open debug console.

  5. In Emacs Javascript, press C-c C-k to send current buffer to Chrome browser.

Y. E.
  • 767
  • 5
  • 9
beetlej
  • 1,098
  • 1
  • 7
  • 20