Comments (1)
When I started working on this, I realized I was doing a lot of work that could be generalized. So I stopped and did this project: https://github.com/dart-embla/template_cache
Later I never got around to make an actual Chalk implementation of the compiler that is required. I'm afraid this project simply isn't done, and probably won't be finished in the foreseeable future. I'm sorry. 😢
If you want a fun project for yourself, you could make your own compiler. The entire foundation for that is in the template_cache project.
import 'dart:async';
import 'package:template_cache/cache.dart';
class YOURCompiler implements Compiler {
final ContentType contentType = ContentType.HTML;
final Iterable<String> extensions = ['.YOUR_ext', '.YOUR_other_ext'];
Future<GeneratedTemplateCode> compile(Uri file, Stream<String> source) async {
// Use the [file] and [source] arguments to generate the code
return new GeneratedTemplateCode(
'''
import "any_imports_that_the_template_runtime_will_need";
''',
r'''
yield r"A line!\n";
yield someLocal + r'\n';
// the generated code is in an async* context, so you can await
await someImportedFunction();
if (someBooleanLocal) {
yield r"A conditional line!\n";
}
'''
);
}
}
from chalk.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chalk.