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?

5
  • Have you tried anything from the old posts you mentioned? What is not working?
    – Dan
    Sep 30, 2021 at 23:22
  • Simply use lsp. I am not sure how much work it is to install and configure on vanilla emacs, but if you want to get going quickly, in an amazing configuration, then use Spacemacs and simply install the javascript and lsp layers (if you prefer Emacs keybindings than simply configure it). After that you will be good to go, just look up what is your major-mode leader key. Oct 2, 2021 at 7:54
  • You could also check out other starter configurations like Doom or Prelude, but I do not have much experience with those. Oct 2, 2021 at 7:55
  • I try js2-mode, but it has been marked "Available Obsolete from melpa" in melpa.
    – lucky1928
    Oct 9, 2021 at 22:28
  • So "basic web dev" here means "Javascript"?
    – phils
    Oct 11, 2021 at 4:56

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.