
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
create-unit
Advanced tools
<img src=https://github.com/henryhale/create-unit/raw/master/starter/src/public/favicon.png />
focus - simplicity - productivity
Unit.js is a lightweight HTML-first static site generator designed to bring focus, simplicity, and enhanced developer productivity to your projects. Powered by Vite, Unit.js encourages a streamlined development experience with a unique approach to components.
Define state and components once, reuse them wherever.
Note: ⚠️ This project is still under development.

Demo link: Click here.
Focus on Simplicity: Unit.js embraces simplicity as a core principle, making it easy for developers to create and manage UI components effortlessly.
File-based Components: Components in Unit.js are represented as files ending with the .unit extension. This convention simplifies organization and encourages a modular structure in your project. You can import .unit files into another .unit file.
HTML Build Output: Generate fully-rendered pages of your website at build time.
Reactive by Choice: Leverage the expressive syntax of reactivity-powered libraries like Alpine.js to create components reactive at runtime.
Note: Unit.js is powered by Vite and so most features can be used directly in your project for example asset handling.
Basic understanding of HTML, CSS, JavaScript and Node.js (npm or pnpm) is required.
Installation
Create a new project, my_app using your preferred package manager.
npx create unit my_app
# pnpm dlx create-unit my_app
Navigate to your project and install dependencies
cd my_app
npm install
# pnpm install
Create Your First Component
Start building your UI component by simply create a new file hello.unit under the src/components/ folder.
<!-- src/components/hello.unit -->
<h1>Hello, Unit.js!</h1>
Import it into the src/pages/index.unit and you're ready to go live.
<!-- index.unit -->
import Hello from "../components/hello.unit";
<Hello />
Of course you can add props html attributes, for example:
...
<Hello class="text-xl" id="hello" />
Run the Development Server
Start the development server to see your changes in real-time.
npm run dev
# pnpm dev
Build for Production
When you're ready to deploy your application, build for production to optimize and minimize your code.
npm run build
# pnpm build
Deployment
After building your project, production files exist in the dist folder at the root of your project. Check out Vite's deployment guide.
.vscode/: contains settings and recommended extensions for Visual Studio Code userssrc/: all your project source files heresrc/components/: contains reusable .unit filessrc/data/: contains composable and state scriptssrc/pages/: contains only .unit files for corresponding html pagessrc/public/: contains assets to be served at the root like favicon.pngsrc/template.html: used to generate html pages from every .unit file in src/pages/ folder on build timesrc/main.js: common script for all pages placed in the src/template.html.
For a different script per page, create another script and add a script tag in the corresponding .unit file under the src/pages/ foldersrc/global.css: Shared CSS stylesContributions are welcome to make Unit.js even better! Feel free to open issues or submit pull requests.
Unit.js is released under the MIT License.
Copyright © 2024-present, Henry Hale
Enjoy the focus, simplicity, and increased productivity that Unit.js brings to your UI development!
FAQs
Build your website in units.
We found that create-unit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.