Create build_jael
This commit is contained in:
parent
1ebef65a60
commit
b8f2888c7d
4 changed files with 94 additions and 0 deletions
15
build_jael/.gitignore
vendored
Normal file
15
build_jael/.gitignore
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### Dart template
|
||||
# See https://www.dartlang.org/tools/private-files.html
|
||||
|
||||
# Files and directories created by pub
|
||||
.packages
|
||||
.pub/
|
||||
build/
|
||||
# If you're building an application, you may want to check-in your pubspec.lock
|
||||
pubspec.lock
|
||||
|
||||
# Directory created by dartdoc
|
||||
# If you don't generate documentation locally you can remove this line.
|
||||
doc/api/
|
||||
.dart_tool
|
23
build_jael/build.yaml
Normal file
23
build_jael/build.yaml
Normal file
|
@ -0,0 +1,23 @@
|
|||
builders:
|
||||
jael:
|
||||
target: "build_jael"
|
||||
import: "package:build_jael/build_jael.dart"
|
||||
builder_factories:
|
||||
- jaelBuilder
|
||||
auto_apply: root_package
|
||||
build_extensions:
|
||||
.jl:
|
||||
- ".html"
|
||||
required_inputs:
|
||||
- .jl
|
||||
defaults:
|
||||
generate_for:
|
||||
- "**/*.html"
|
||||
- "*.html"
|
||||
- "**.html"
|
||||
targets:
|
||||
$default:
|
||||
sources:
|
||||
- "**/*.html"
|
||||
- "*.html"
|
||||
- "**.html"
|
41
build_jael/lib/build_jael.dart
Normal file
41
build_jael/lib/build_jael.dart
Normal file
|
@ -0,0 +1,41 @@
|
|||
import 'dart:async';
|
||||
import 'package:build/build.dart';
|
||||
import 'package:code_buffer/code_buffer.dart';
|
||||
import 'package:file/file.dart';
|
||||
import 'package:jael/jael.dart' as jael;
|
||||
import 'package:jael_preprocessor/jael_preprocessor.dart';
|
||||
|
||||
class JaelBuilder implements Builder {
|
||||
final BuilderOptions options;
|
||||
|
||||
const JaelBuilder(this.options);
|
||||
|
||||
@override
|
||||
Map<String, List<String>> get buildExtensions {
|
||||
return {
|
||||
'.jl': ['.html'],
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Future build(BuildStep buildStep) async {
|
||||
CodeBuffer buf;
|
||||
|
||||
if (options.config['minify'] == true)
|
||||
buf = new CodeBuffer(space: '', newline: '', trailingNewline: false);
|
||||
else
|
||||
buf = new CodeBuffer();
|
||||
|
||||
Directory dir;
|
||||
|
||||
var errors = <jael.JaelError>[];
|
||||
|
||||
var doc = await jael.parseDocument(
|
||||
await buildStep.readAsString(buildStep.inputId),
|
||||
sourceUrl: buildStep.inputId.uri,
|
||||
onError: errors.add,
|
||||
);
|
||||
|
||||
if (errors.isNotEmpty) {}
|
||||
}
|
||||
}
|
15
build_jael/pubspec.yaml
Normal file
15
build_jael/pubspec.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
name: build_jael
|
||||
version: 1.0.0
|
||||
description: Compile Jael files to HTML using the power of `package:build`.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/jael/tree/master/build_jael
|
||||
environment:
|
||||
sdk: ">=1.19.0 <=2.0.0"
|
||||
dependencies:
|
||||
build: ^0.12.0
|
||||
build_config: ^0.2.0
|
||||
code_buffer: ^1.0.0
|
||||
file: ^2.0.0
|
||||
jael: ^1.0.0-alpha
|
||||
jael_preprocessor: ^1.0.0-alpha
|
||||
symbol_table: ^1.0.0
|
Loading…
Reference in a new issue