Pergunta

I'm looking for a tool like "gruntjs" which can monitor my dart project, and when file changes, it's able to:

  1. convert dart files to javascript files
  2. restart my custom dart command: dart app.dart

I don't find any plugin for gruntjs to do this, is there such a tool for dart?

Foi útil?

Solução

You can use the Dart Editor Build System to build your own tool to this. Whenever a file changes Dart Editor looks for build.dart at the root of the project and attempts to run the commands in main(). In your build file you can invoke dart2js on your project, call your custom dart command and do whatever else is involved in building the project. This is how WebUI manages compilation of web components.

For more information on the Dart Editor Build System and for some example build.dart files see Build.dart and the Dart Editor Build System.

Outras dicas

There is also a hop.dart can do this job. Which has some limitations compared to tools like gruntjs, but it's working well for simple tasks like dart2js.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top