webui_tasks 0.0.1 webui_tasks: ^0.0.1 copied to clipboard
A webui task library based on Hop.
A Webui task library based on Hop. #
What is Webui? #
Webui allows you to create web applications like you would legos, piecing the framework from reusable components. See article for an introduction.
What is Hop? #
Hop is a framework that simplifies and automates console tasks in Dart. See Hop Pub package for more information. Also see article for a quick tutorial.
How will this library help me? #
This library will allow you to:
- Compile webui components to Javascript in one console step as well as minidart compilation (dart to dart).
- Fix the relative Urls in the output Webui entry point Html file.
- Copy static assets such as Javascript linked from the entry point Html file into the target output directory.
Dart Documentation coming soon.
How do I get started? #
This library isn't yet published on pub. Meanwhile, you can add the following dependency:
dependencies:
webui_tasks:
git: https://github.com/damondouglas/webui_tasks.dart
Example #
library hop_runner;
import 'dart:async';
import 'dart:io';
import 'package:hop/hop.dart';
import 'package:hop/hop_tasks.dart';
import 'package:webui_tasks/webui_tasks.dart';
void main() {
String entryPointPath = "web/simple.html";
// Copy out static linked assets such as packages/browser/dart.js
Task co = createCopyOutTask(entryPointPath);
addTask("co", co);
// Fix Urls in entrypoint to point to static assets and appropriate main Javascript file.
Task fixjs = createFixUrlTask("output/simple.html", outputType:WebuiTargetType.JS);
addTask("fixjs",fixjs);
// Call DWC and dart2js compilers.
ChainedTask w2d2js = createWebui2JsTask(entryPointPath);
addTask("w2d2js", w2d2js);
// Run all three tasks at once to deploy Javascript from webui.
addChainedTask('deployjs', ['w2d2js','co','fixjs']);
// Fix Urls in entrypoint to point to static assets and appropriate minified main Dart script file.
Task fixmd = createFixUrlTask("output/simple.html", outputType:WebuiTargetType.MINIDART);
addTask("fixmd", fixmd);
ChainedTask w2d2d = createWebui2MiniDartTask(entryPointPath);
addTask("w2d2d", w2d2d);
// Run all three tasks at once to deploy Minidart from webui.
addChainedTask('deploymd', ['w2d2d','co','fixmd']);
runHop();
}
Deploy project as Javascript #
- Run in webui project root as
dart tool/hop_runner.dart deployjs
- Open
output/simple.html
in any modern browser. See hosted example.
Deploy project as mini dart #
- Run in webui project root as
dart tool/hop_runner.dart deploymd
- Open
output/simple.html
in Chromium.
From example in sample webui project
Authors #
- Damon Douglas (+Damon Douglas)
- You? File bugs. Fork and Fix bugs. Let's build this community.
Acknowledgements #
- Kevin Moore for his work on the Hop and Webui Widget libraries, from which much of this code and methodology derives.
- Seth Ladd for his original idea that inspired the project.