ConstexprJS is a command-line tool for static site builders that evaluates and strips JavaScript from a website ahead of publication, producing HTML-only output.
What is ConstexprJS?
ConstexprJS is a Node.js command-line utility published on npm that takes a website with client-side JavaScript and produces a version where the scripts have been evaluated and removed at build time. It is installed globally with npm i -g constexprjs@latest and invoked from the terminal. The project's official demo is the author's own site at https://amokfa.github.io, with sources on GitHub. The repository description notes that the tool no longer works and the author currently edits the site using ChatGPT, so it should be considered an archival project rather than an actively maintained tool.
Key Features
- Evaluate-and-strip workflow — Pre-computes JavaScript behavior and outputs a site with the script effects applied and the original JS removed.
- Command-line installation — Installs globally via npm using
npm i -g constexprjs@latestand runs as a CLI tool. - Static site integration — Repository metadata lists Hugo and Jekyll as topics, indicating the tool was used with popular static site generators.
- Documentation suite — Links to an introduction, a hello-world tutorial, and a series of guides for learning the tool.
- Demo site — The project page links to a live demo at amokfa.github.io with source code on GitHub.
- npm distribution — Published on the npm registry, with a version badge indicating releases are managed through npm.
Who is it for?
ConstexprJS is aimed at developers who build static websites and want to eliminate client-side JavaScript entirely. It suits Hugo and Jekyll users who want to pre-evaluate interactive components at build time. It is also relevant for performance-conscious site owners who want their final output to consist only of HTML and CSS.
What can you do with ConstexprJS?
- Static site developers: run the CLI on a generated site to produce an HTML-only version with scripts stripped, useful for progressive enhancement.
- Blog authors: pre-render interactive elements such as search forms or comment widgets into static HTML so content stays readable without JavaScript.
- Performance engineers: measure and reduce the JavaScript payload of a finished site, shrinking file size and improving page load metrics.
FAQ
Is ConstexprJS free?
ConstexprJS is an open-source npm package with no pricing information on the project page. You can install it globally with npm i -g constexprjs@latest without any license fee.
Does ConstexprJS work with Hugo?
Repository topics list both Hugo and Jekyll, suggesting the tool was designed to work with those static site generators. However, the project description states the tool no longer works, so testing against current Hugo versions is not recommended.
Is ConstexprJS still maintained?
The repository description explicitly says "Doesn't work anymore and I use chatgpt to edit my site these days," which indicates the project is not actively maintained and should not be used in production.
What does ConstexprJS do?
It evaluates the JavaScript on a website ahead of time and strips the scripts from the output, leaving a static HTML version of the page with the evaluated behavior already applied.








