The best practice to embed small amount of Dart code into large amount of JS code base?

96 views
Skip to first unread message

Kun Li

unread,
Mar 29, 2015, 1:52:37 AM3/29/15
to mi...@dartlang.org
Here is the example scenario I am facing with:

Say I have a website based on Web Starter Kit, so it's organized in a really nice way, all different gulp tasks to deal with LESS, js combing, etc.

Now we plan to add a user center into the project, which has very heavy data visualization and relatively complex logic to deal with. So I want to use Dart for this specific part, but I still want the code base of this part to play nicely with all the other WSK codes.

One way to do it is to set up a separate Dart project just for user center, then use a script to copy the compiled code to WSK code base. However, if I do this, I can not reuse all the css code I have in WSK. So it's a no-go for me.

Then another way I am going to try is to set up Dart project INTO WSK, which means pubspec.yaml is going to be at the same folder with gulpfile.js . I then have all dart code mixed with WSK code, and the generated js code will be redirected to "app" folder, which is the folder gulp compile the code to too.

Before I put significant effort in, I want to know if it's really the best way I can do, or if there is other approaches I missed. Even in this way it's still not convenient to do local dev, for example, with original WSK code, I can run gulp serve, which will open a tab for me and live refresh whenever I make change in the code. Apparently it doesn't work with Dart. Dart has it's own way to do live debugging, I'm just not sure how can it handle the LESS code.

Anyway, I'm still evaluating the options of whether doing it in Dart or JS. Any suggestions would be welcome. 

Bob Nystrom

unread,
Mar 30, 2015, 1:43:04 PM3/30/15
to General Dart Discussion
If you don't get much of a response here, you may also want to try the w...@dartlang.org list which has people more focused on problems like this.

Cheers!

- bob


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Kun Li

unread,
Mar 30, 2015, 1:58:38 PM3/30/15
to mi...@dartlang.org
Thanks Bob, will do.
Reply all
Reply to author
Forward
0 new messages