skeeto/skewer-mode — dự án mã nguồn mở — đang có 1.1k sao GitHub. Live web development in Emacs
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Provides live interaction with JavaScript, CSS, and HTML in a web
browser. Expressions are sent on-the-fly from an editing buffer to be
evaluated in the browser, just like Emacs does with an inferior Lisp
process in Lisp modes.
Watch the demo video on YouTube
(webm)
Skewer is available from MELPA, which will install the
dependencies for you. This package and its dependencies are pure
Elisp, meaning setup is a breeze, the whole thing is highly portable,
and it works with many browsers.
Dependencies:
simple-httpd (available on MELPA)
js2-mode (available on ELPA)
Skewer requires Emacs 24.3 or later.
Usage
Quick version
If Skewer was installed from MELPA, skip to step 3.
Put this repository directory in your load-path
Load skewer-mode.el
M-x run-skewer to attach a browser to Emacs
From a js2-mode buffer with skewer-mode minor mode enabled,
send forms to the browser to evaluate
The function skewer-setup can be used to configure all of mode hooks
(previously this was the default). This can also be done manually like
so,
The keybindings for evaluating expressions in the browser are just
like the Lisp modes. These are provided by the minor mode
skewer-mode.
C-x C-e: Evaluate the form before the point and display
the result in the minibuffer. If given a prefix argument, insert
the result into the current buffer.
C-M-x: Evaluate the top-level form around the point.
C-c C-k: Load the current buffer.
C-c C-z: Select the REPL buffer.
The result of the expression is echoed in the minibuffer.
Additionally, css-mode and html-mode get similar sets of bindings
for modifying the CSS rules and HTML on the current page.
CSS
C-x C-e: Load the declaration at the point.
C-M-x: Load the entire rule around the point.
C-c C-k: Load the current buffer as a stylesheet.
HTML
C-M-x: Load the HTML tag immediately around the point.
Note: run-skewer uses browse-url to launch the browser. This may
require further setup depending on your operating system and personal
preferences.
Multiple browsers and browser tabs can be attached to Emacs at once.
JavaScript forms are sent to all attached clients simultaneously, and
each will echo back the result individually. Use list-skewer-clients
to see a list of all currently attached clients.
Sometimes Skewer's long polls from the browser will timeout after a
number of hours of inactivity. If you find the browser disconnected
from Emacs for any reason, use the browser's console to call
skewer() to reconnect. This avoids a page reload, which would lose
any fragile browser state you might care about.
Manual version
To skewer your own document rather than the provided blank one,
Load the dependencies
Load skewer-mode.el
Start the HTTP server (httpd-start)
Include "http://localhost:8080/skewer" as a script
(see example.html and check your httpd-port)
Visit the document from your browser
Skewer fully supports CORS so the document need not be hosted by Emacs
itself. A Greasemonkey userscript is provided, Skewer Everything,
for injecting Skewer into any arbitrary page you're visiting without
needing to modify the page on the host. More information below.
Don't copy skewer.js anywhere or use it directly. Emacs hosts
this script itself, manipulating it in memory before it reaches the
browser. Always access it through the servlet on the Emacs webserver
as /skewer.
Browser Support
Skewer is known to work properly with Firefox, Chrome, Safari, Opera,
and IE8+. Except for CSS and HTML, Skewer will work in IE7 when
document.querySelector and JSON are polyfilled. If you find any
other JavaScript-supported browser that doesn't work with Skewer,
please report it.
REPL
A REPL into the browser can be created with M-x skewer-repl, or
C-c C-z. This should work like a console within the
browser. Messages can be logged to this REPL with skewer.log() (like
console.log()).
Results of expressions evaluated in the REPL are printed more
verbosely than in the minibuffer, when possible. This may help in
debugging.
Skewering with CORS
Skewer supports Cross-origin Resource Sharing (CORS). This
means you can Skewer a document hosted from any server without needing
any special changes on that server, except for including /skewer as
a script in that document.
If you don't control the server from which you want to skewer pages --
such that you can't add the Skewer's script -- the provided
Greasemonkey userscript (.user.js) can be used to inject it into any
page you visit. Note that this userscript will assume you're running
the Skewer server at http://localhost:8080/ (simple-httpd's default
port). If this isn't true, you need to edit the top of the userscript.
The script isn't actually injected until you switch the toggle in the
top-right corner, the red/green triangle.
Alternatively, the following bookmarklet will load skewer on demand:
With a browser plugin like
Custom Javascript for Websites,
you can use the bookmarklet to auto-skewer specific domains, saving you a
mouse click on each reload.
bower
Also provided are some functions for loading libraries from the bower
infrastructure on the fly. This is accessed with skewer-bower-load.
For example, I often find it useful to load jQuery when skewering a
page that doesn't have jQuery installed.
Note: to use this bower does not need to be installed, only git.
It's just the bower infrastructure being used. Unfortunately this
infrastructure is a mess right now; many packages are in some sort of
broken state -- missing dependencies, missing metadata, broken
metadata, or an invalid repository URL. Some of this is due to
under-specification of the metadata by the bower project.
Motivation
I wanted something like swank-js but without all the
painful setup. Having already written an Emacs web server I was
halfway there. It took relatively little code to accomplish.
I also didn't want to rely a browser-specific feature, like MozRepl or
WebKit's remote debugger (kite).
The name refers to the idea that Emacs is skewering the browser from
server-side.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/skeeto/skewer-mode là nguồn chính thức.
skeeto/skewer-mode có bao nhiêu sao?
skeeto/skewer-mode có 1.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/skeeto/skewer-mode. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
skeeto/skewer-mode có phải mã nguồn mở không?
Có — skeeto/skewer-mode phát hành theo license Unlicense, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/skeeto/skewer-mode.
skeeto/skewer-mode có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho skeeto/skewer-mode. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
skeeto/skewer-mode có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho skeeto/skewer-mode. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
skeeto/skewer-mode còn đang phát triển không?
Commit gần nhất trên skeeto/skewer-mode là 2 tháng trước (theo timestamp GitHub). Repo có 57 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc skewer-mode có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về skewer-mode.