Giter Club home page Giter Club logo

bdo's Introduction

Do be do

This library lets Emacs talk to a page in a web browser. For now, it's specifically aimed at telling the browser to update the stylesheet, in a similar fashion to Firefox's latest Style Editor.

Video examples

Usage

Add the library path (this is needed to be able to find bdo.js):

(add-to-list 'load-path "/the/path/to/bdo")

Optional keybinding:

(define-key css-mode-map (kbd "C-x C-s") 'css-refresh)
(defun css-refresh ()
  "Refresh the current CSS file."
  (interactive)
  (when (buffer-modified-p)
    (save-buffer))
  (bdo-refresh))

To make Emacs start listening, run

M-x bdo-listen

Then add the following in your web page:

<script type="text/javascript" src="http://localhost:9090/bdo"></script>

You can use a browser userscript to make your browser insert that line on the fly, on some webs. See contrib/bdo.user.js.

The script depdends on jQuery. If that's a problem, you can hack around it and give me a patch.

(Or whichever port you configured bdo-port to, if you changed it.)

Load your web page, it will connect to Emacs. Emacs will say “New client: http://your/address”, or if you refresh, it says “Client re-connected: http://your/address”.

Go to your stylesheet file in Emacs which corresponds to one of the .css files loaded with a link tag in your page. Run M-x bdo-refresh.

  • This will prompt for which client (browser page) you want to talk to, and then it will prompt which CSS file corresponds to this one.
  • Then it will tell the browser to refresh that stylesheet. Running M-x bdo-refresh again will not prompt for these again.

If you change your mind, you can run M-x bdo-set-client or M-x bdo-set-link to set the client or link element referred to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.