warden 0.4.1
warden: ^0.4.1 copied to clipboard
Static Builder CLI

Static builder & bundler for Dart projects
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
β¨ Features #
- π Watches your Dart and Sass files and recompiles on change
- π¦ Moves specified dependencies (e.g. node_modules assets) into your build output
- π οΈ Bundles your dependency JS files into a single
bundle.js
(optional) - 𧱠Fully configurable via a
warden.yaml
file - π― Supports multiple tasks like compiling Dart to JS and Sass to CSS
βοΈ Setup #
Create a warden.yaml
in your project root:
# The root directory of your source files
source_dir: examples
# Where to output built files (JavaScript, CSS, etc.)
destination: static/
# Dependency handling (e.g. node_modules)
dependencies:
source: examples/node_modules
bundle: true # (Optional) Bundle all files into a single bundle.js
main: static/main.js # (Optional) Dart-built JS to append to the bundle
files:
- 'poppyjs/dist/Poppy.min.js'
- 'bootstrap/dist/js/bootstrap.min.js'
# (Optional) Copies across assets folders (e.g. containing .png, .jpg) to the destination directory
assets:
source: example/assets
directories: # The directory in source path that you want to copy across to the destination directory
- img
# Tasks to run (like build steps)
tasks:
frontend:
executable: dart
args: ["compile", "js", "bin/main.dart", "-o", "../static/main.js"]
src: examples # Working directory for Dart files
styles:
executable: dart
args: ["run", "sass", "sass/index.scss:../static/index.css"]
src: examples # Working directory for Sass
warnings: false # Optional: suppress warnings for this task (default is true)
βΆοΈ Running #
Run Warden from your terminal in watch mode:
dart run warden --file=warden.yaml
This will: β’ Move files listed in dependencies.files into the output directory β’ Bundle them into a single bundle.js if bundle: true β’ Compile Dart to JS β’ Compile Sass to CSS β’ Watch and recompile on file changes
π¦ Installation #
dart pub global activate warden
Then run from any Dart project:
warden --file=warden.yaml
π§ͺ Example Project Structure #
examples/
βββ bin/
β βββ main.dart
βββ lib/
β βββ examples.dart
βββ sass/
β βββ index.scss
βββ node_modules/
βββ warden.yaml
License
MIT Β© 2025 joegasewicz