zero_coding zero_coding - 2 months ago 21
Dart Question

What are the transformers mean?

I have a yaml file with following content:

- angular2:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart

What does platform_directives means?


Transformers are a feature of the pub tool.

Transformer can transform existing code before it is delivered to the browser. dart2js that transpiles Dart code to JS is also available as transformer (also available as standalone tool)

A transformer is a Dart program that is registered in pubspec.yaml (like shown in your question) and then executed by pub serve or pub build for every source file. A transformer can then take such a source file and modify it before it's passed to the next transformer or to the browser (pub serve or to a file on the disk (pub build). Also new files can be generated.