Static builder & bundler for Dart projects. Inspired by Webpack.
Warden is a lightweight CLI tool to watch and compile Dart and Sass files for frontend projects that don’t use Flutter, are focused on building to JavaScript for server-side rendered apps, and work with Node-installed packages. It’s ideal for projects that still want custom JS/CSS assets compiled automatically.
📚 Docs: pub.dev/packages/warden
- 🔁 Watches your Dart and Sass files and recompiles on change
- 📦 Moves specified dependencies (e.g. node_modules assets) into your build output
- 🗂️ Moves specified asset directories (e.g.
assets/img/) into your build output - 🛠️ Bundles your dependency JS files into a single
bundle.js(optional) - 🧱 Fully configurable via a
warden.yamlfile - 🎯 Supports multiple tasks like compiling Dart to JS and Sass to CSS
- 🧪 Debug mode logging to see every file operation and build step
- 🚀 Production mode for optimised builds with minified output
dart pub global activate wardenThen run:
warden --file=warden.yamlRun Warden in watch mode:
warden --watch
# Or define the file path is not in the project root.
warden --file=warden.yaml --watchOr for a one-off build:
warden --build
# Or define the file path is not in the project root.
warden --file=warden.yaml --buildDebug mode (development) will show verbose file change and build logs.
Switch to production to build optimised/minified JS and CSS.
dart run warden --file=warden.yaml --watch --debugCreate a warden.yaml in your project root:
# ==============================
# Warden Configuration
# ==============================
# The root directory of your source files
source_dir: example
# The environment mode to run in (choose 'development' or 'production')
# 🧪 development → Local dev settings, debug logging enabled
# 🚀 production → Live site settings, minified builds
mode: development # Default is development
# Where to output built files (JavaScript, CSS, etc.)
destination: example/static/
# Main Dart-built JS file (output location)
main_file: example/static/main.js
# ==============================
# Dependencies
# ==============================
dependencies:
- source: example/node_modules
bundle: true
files:
- "poppyjs/dist/Poppy.min.js"
- "bootstrap/dist/js/bootstrap.min.js"
- "bootstrap/scss/bootstrap.scss"
# ==============================
# Static Assets
# ==============================
assets:
source: example/assets
directories:
- img # Copies `example/assets/img` → `example/static/img`
compress:
quality: 70 # File compression for your shipped file assets
# ==============================
# Build Tasks
# ==============================
tasks:
frontend:
executable: dart
args: ["compile", "js", "bin/main.dart", "-O4", "-o", "static/main.js"]
src: example
styles:
executable: dart
args: ["run", "sass", "sass/index.scss:static/index.css"]
src: example
warnings: false
# ==============================
# Environment Variables
# These are injected at compile time for Dart
# ==============================
environment:
dev:
API_URL: "http://localhost:1234/api/v1"
CAT_TYPE: "siberian"
DEBUG_MODE: "true"
prod:
API_URL: "https://www.google.com"
DEBUG_MODE: "false"examples/
├── bin/
│ └── main.dart
├── lib/
│ └── examples.dart
├── sass/
│ └── index.scss
├── node_modules/
├── warden.yaml
Contributions
Please open an issue or reply to an existing issue requesting that you would like
to work on it. PRs that do not fix a known bug or add new features will be closed.
License
MIT © 2025 joegasewicz

