72 lines
2.4 KiB
Markdown
72 lines
2.4 KiB
Markdown
# Iceberg
|
|
|
|
Iceberg is an early-stage, framework-independent JavaScript build tool for production frontend builds. It uses [Rolldown](https://rolldown.rs/) for JavaScript and TypeScript bundling and [Lightning CSS](https://lightningcss.dev/) for CSS processing.
|
|
|
|
## Current support
|
|
|
|
- `iceberg build`, `--help`, and `--version`
|
|
- `index.html` with one local module script entry
|
|
- JavaScript, TypeScript, JSX/TSX syntax supported by Rolldown
|
|
- npm and relative ESM imports
|
|
- CSS imported from JavaScript and linked from HTML, including CSS `@import`
|
|
- common image and font asset imports
|
|
- hashed JavaScript, CSS, and emitted asset filenames
|
|
- minification, tree shaking, optional source maps, base paths, and a small `iceberg.config.js`
|
|
- programmatic `build()` and `defineConfig()` APIs
|
|
|
|
## Installation and quick start
|
|
|
|
```bash
|
|
npm install -D @fretuks/iceberg
|
|
```
|
|
|
|
```json
|
|
{ "scripts": { "build": "iceberg build" } }
|
|
```
|
|
|
|
Run `npm run build` from a project containing `index.html` and a module script such as `/src/main.js`. Iceberg writes production files to `dist/`.
|
|
|
|
## Configuration
|
|
|
|
Iceberg works without configuration. The optional `iceberg.config.js` file supports:
|
|
|
|
```js
|
|
import { defineConfig } from '@fretuks/iceberg';
|
|
|
|
export default defineConfig({
|
|
root: process.cwd(),
|
|
base: '/site/',
|
|
build: { outDir: 'build', minify: true, sourcemap: false, emptyOutDir: true }
|
|
});
|
|
```
|
|
|
|
## Frost CSS
|
|
|
|
Frost is supported through its normal npm export; Iceberg contains no Frost-specific logic:
|
|
|
|
```bash
|
|
npm install @fretuks/frost
|
|
```
|
|
|
|
```js
|
|
import '@fretuks/frost';
|
|
```
|
|
|
|
The inspected Frost package is `@fretuks/frost@0.3.0`. Its `.` and `./frost.css` exports point to precompiled `frost.css`, which imports the other CSS modules through ordinary CSS imports. The working example is in `examples/frost`.
|
|
|
|
## Programmatic API
|
|
|
|
```js
|
|
import { build, defineConfig } from '@fretuks/iceberg';
|
|
|
|
await build(defineConfig({ build: { outDir: 'dist', minify: true } }));
|
|
```
|
|
|
|
## Known limitations
|
|
|
|
Phase 1 intentionally has no development server, HMR, preview command, framework adapters, SSR, plugin API, or scaffolding. HTML currently supports one local module script entry. CSS asset URL rewriting beyond the standard relative output layout is still conservative; projects should keep CSS assets next to the stylesheet or use imported assets where possible.
|
|
|
|
## License
|
|
|
|
MIT. Iceberg is in early development; APIs may evolve before the 1.0 release.
|