TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Wd-40, a static webserver with automatic hot-reloads

108 点作者 baalimago9 个月前
It works by injecting a websocket script which listens for file changes. The filechanges are detected using the go fsnotify package, which in turn uses the different OS&#x27;s equivalent to inotify.<p>I basically got bored with alt-tabbing and refresing when developing &#x27;vanilla-js&#x27;. The hot-reload in the modern frameworks are very nice, so figured I&#x27;d recreate it.

17 条评论

pwg9 个月前
My only comment is: &quot;be prepared for a cease and desist from the lawyer&#x27;s for the real WD-40 company&quot; over the name choice.<p>The fact that they make spray lubricants and you have a website re-loader will likely not make any difference to them.
评论 #41297996 未加载
评论 #41306908 未加载
评论 #41315984 未加载
评论 #41284384 未加载
评论 #41310103 未加载
评论 #41317102 未加载
评论 #41307057 未加载
Brajeshwar9 个月前
I thought the name was inspired by a cheap, easily available lubricant that comes in handy for every home.<p>I&#x27;ve tried many simple servers for experimenting with simple static websites (HTML, CSS, JS). I&#x27;m currently settled on LiveReload[1] and BrowserSync[2]. LiveReload attaches to other tooling and is more straightforward, while Brower-Sync when looking across a few multiple browsers (out of habit). I&#x27;m not particularly fond of tooling that attaches to an IDE, but I like more of the ones that I can pipe with arguments. But then again, I do straightforward stuff these days.<p>LiveReload should also be easily attachable to a simple `python -m SimpleHTTPServer 8000`.<p>1. <a href="https:&#x2F;&#x2F;github.com&#x2F;livereload">https:&#x2F;&#x2F;github.com&#x2F;livereload</a><p>2. <a href="https:&#x2F;&#x2F;browsersync.io" rel="nofollow">https:&#x2F;&#x2F;browsersync.io</a>
评论 #41306782 未加载
评论 #41308385 未加载
评论 #41307385 未加载
onetom9 个月前
I&#x27;ve settled on devd (modd) for the past few years. <a href="https:&#x2F;&#x2F;github.com&#x2F;cortesi&#x2F;devd">https:&#x2F;&#x2F;github.com&#x2F;cortesi&#x2F;devd</a><p>It&#x27;s a single file go executable. Supports CORS too. I use it via direnv &amp; nix-shell.
password43219 个月前
I am the self-appointed HN sales pitch for <a href="https:&#x2F;&#x2F;github.com&#x2F;sigoden&#x2F;dufs">https:&#x2F;&#x2F;github.com&#x2F;sigoden&#x2F;dufs</a>, a fileserver including webdav.
评论 #41309424 未加载
meblum9 个月前
Here’s my hot-reload tool <a href="https:&#x2F;&#x2F;github.com&#x2F;meblum&#x2F;serv">https:&#x2F;&#x2F;github.com&#x2F;meblum&#x2F;serv</a> it reloads html files when any of its dependencies have changed. Written in Go with zero dependencies and requires no config. Uses server-sent-events to notify webpage of updates. Feedback appreciated.
pierrec9 个月前
Nice, I&#x27;ve used an editor plugin for this before, but I like that this isn&#x27;t tied to any specific editor. Actually Hugo also does this, though again that&#x27;s tied to a framework:<p><a href="https:&#x2F;&#x2F;gohugo.io&#x2F;getting-started&#x2F;usage&#x2F;#livereload" rel="nofollow">https:&#x2F;&#x2F;gohugo.io&#x2F;getting-started&#x2F;usage&#x2F;#livereload</a><p>Also curious about this: <i>&quot;The delta-streamer.js script then checks if the current window origin is the updated file. If so, it reloads the page.&quot;</i><p>Does that mean it doesn&#x27;t auto-refresh if dependencies (scripts, stylesheets, etc) are updated? Maybe there&#x27;s room for improvement here though I&#x27;m not sure how I would approach it. Maybe just an option to skip the check would do the job.
评论 #41310709 未加载
winter_blue9 个月前
This is pretty cool. I have two questions, regarding the mirroring:<p>1. For the mirroring, are you using something like rsync (with modifications for the web socket script injection) underneath? Also, will the mirroring reflect destructive changes (like rsync&#x27;s --delete flag), like if a directory or file is deleted in the original content directory?<p>2. Could you avoid mirroring the content directory, and just directly serve the original content directory, by just simply on-the-fly injecting the relevant script tag in text&#x2F;html files? (Or, only mirroring those text&#x2F;html files, and serving the remaining files from the original content directory.)
评论 #41307112 未加载
mixmastamyk9 个月前
You can do this with inotify-tools and a wrapper script. Needs a little something on the browser side to make it seamless however.
nashashmi9 个月前
Should W3C work on a way to do socket connections without JS? It is not high on the list but is popular enough. Things that are more important to be done without JS are horizontal scrolling of items (marquee on steroids?) and slideshows,
1oooqooq9 个月前
between this and liveview... and the infinity websites doing timed or pull-check reloads...<p>is this the best the web have to offer in terms of standards to keep one tab with fresh content? i recall some push standard discussions
评论 #41311366 未加载
评论 #41309595 未加载
bufferoverflow9 个月前
So what happens when you have more than 64K simultaneous viewers?
dufzh9 个月前
Sounds similar to the &#x27;live server&#x27; plugin in vscode
Alifatisk9 个月前
Does it support SSI?
评论 #41292789 未加载
est9 个月前
I am glad such tool exists, but PHP was &quot;hot-reloading&quot; like what, 20 years ago?
评论 #41310166 未加载
评论 #41308978 未加载
wannacboatmovie9 个月前
Static web servers have been a solved technical problem for going on 25 years.
评论 #41307429 未加载
评论 #41307140 未加载
评论 #41310264 未加载
drpossum9 个月前
Here&#x27;s literally the same link to a repo from the author from two days ago<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41284189">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=41284189</a><p>How many times do you feel the need to repeatedly hype this?
评论 #41310739 未加载
AbraKdabra9 个月前
I really don&#x27;t know how you didn&#x27;t think of the &quot;dodging potential lawsuit&quot; before posting it here, I mean, you didn&#x27;t know that using actual product names is wrong? It&#x27;s a shame though, I liked the word play.
评论 #41310727 未加载