warden 0.2.1
warden: ^0.2.1 copied to clipboard
Static Builder CLI
Warden #
Static Builder CLI
Warden is a lightweight CLI tool to watch and compile Dart and Sass files for frontend projects. It's designed for projects that use server-side rendered HTML but 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.yamlfile - ๐ฏ 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'
# Tasks to run (like build steps)
tasks:
frontend:
executable: dart
args: ["compile", "js", "bin/main.dart", "-o", "../static/main.js"]
src: examples
styles:
executable: dart
args: ["run", "sass", "sass/index.scss:../static/index.css"]
src: examples
โถ๏ธ 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 (coming soon) #
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