UnitSwitch is a web-based converter for units of measurement common in web development and UX design. It supports point-and-click and keyboard-driven workflows.
In addition to its practical function, the project is an exploration in framework-free UI development.
demo.mp4
- 14 unit types - including CSS lengths (px, rem, em) and viewport units (vw, vh, vmin, vmax)
- Bidirectional conversion - enter a value in any of the supported units, see conversions to all others
- One-click clipboard copy
- Keyboard shortcuts - Ctrl+K to launch keyboard workflow, letter keys to copy specific units (p for px, r for rem, etc.)
- Design ratios - calculates corresponding lengths (Golden Ratio, Root 2, 16:9)
- Customizable settings - adjust base font size, viewport dimensions, PPI, and character ratios
Browser Support: Modern browsers (Chrome, Firefox, Safari, Edge)
This implementation prioritizes shipping minimal, auditable code to the browser. Core runtime functionality uses vendored solutions rather than npm packages, reducing supply-chain risk and keeping dependencies transparent and stable.
Build tooling provides compile-time ergonomics without runtime cost.
- Build: Deno + Vite with TypeScript (strict mode)
- UI: Custom JSX factory functions (
just-jsx) + Tailwind CSS - State: Custom reactive state library (
simple-state) with pub/sub pattern - Patterns: Rust-inspired Result<T, E> for error handling, declarative validation
UnitSwitch is built with Deno. Follow these steps to run locally:
-
Clone the Repository:
git clone https://github.com/ge3224/unitswitch.git cd unitswitch -
Install Deno: If you don't have Deno installed, visit deno.land for installation instructions.
-
Start the Development Server:
deno task dev
-
Access UnitSwitch: Open your browser and navigate to
http://localhost:5173
deno task buildThe optimized build will be output to the dist/ directory.
UnitSwitch is maintained by Jacob Benison.
This project is licensed under the MIT License. See the LICENSE file for more details.
