Kasper Peulen
2015-07-26 15:22:41 UTC
Hi all,
Some time ago I made this video about how to easily clone a dartpad in
webstorm:
Now dartpad stores their snippet as gist, and as gist allow only a flat
project structure, every dartpad uses a flat structure as well with the
following files:
index.html, main.dart and styles.css.
Now the problem is that, pub doesn't really seem to support this structure.
So if you are going to include packages, and transformers, things become a
bit less easy then as this video suggests.
For example `pub serve .` will not work. Webstorm does some magic, at least
in Webstorm 10, I could get any kind of snippet to work.
For example this angular 2 snippet:
https://gist.github.com/kasperpeulen/dd353c3d95b2da3dd74b
Webstorm seems to use `pub serve packages` in this case to serve the flat
structure:
/usr/local/opt/dart/libexec/bin/pub serve packages --port=63372
Loading source assets...
Serving angular2.angular2_NgIf packages on http://localhost:63372
Build completed successfully
[packages] GET /angular2/src/reflection/reflection.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/reflection.dart
[packages] GET /angular2/src/reflection/reflection_capabilities.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/reflection_capabilities.dart
[packages] GET /angular2/angular2.dart => angular2.angular2_NgIf|packages/angular2/angular2.dart
[packages] GET /angular2/src/reflection/reflector.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/reflector.dart
[packages] GET /angular2/src/reflection/types.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/types.dart
[packages] GET /angular2/src/reflection/platform_reflection_capabilities.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/platform_reflection_capabilities.dart
But now in Webstorm 11, this doesn't work anymore, as there is no packages
directory anymore.
I think it would be great if pub would support something like `pub serve
.` or maybe some convention like `pub serve dartpad` or `pub serve gist`.
This is just so that people can easily share code. So if someone at slack
ask, "hi all, how I could I setup oauth2 github authencitation with only
client side code in dart?"
Then I can just share this gist:
https://gist.github.com/kasperpeulen/ec3f3717f398ccce389e
Clone it in your editor, and it will run out of the box.
I'm trying to setup some kind of community driven dart cookbook, and this
website also uses gists as backend with the same convention as dartpad
(index.html/main.dart/styles.css).
I want to make sure every snippet on this website pass the following
quality standard: "every dartpad/gist will run directly out of the box in
your editor."
I can only make this promise, if dart allows to run a flat structure
Some time ago I made this video about how to easily clone a dartpad in
webstorm:
Now dartpad stores their snippet as gist, and as gist allow only a flat
project structure, every dartpad uses a flat structure as well with the
following files:
index.html, main.dart and styles.css.
Now the problem is that, pub doesn't really seem to support this structure.
So if you are going to include packages, and transformers, things become a
bit less easy then as this video suggests.
For example `pub serve .` will not work. Webstorm does some magic, at least
in Webstorm 10, I could get any kind of snippet to work.
For example this angular 2 snippet:
https://gist.github.com/kasperpeulen/dd353c3d95b2da3dd74b
Webstorm seems to use `pub serve packages` in this case to serve the flat
structure:
/usr/local/opt/dart/libexec/bin/pub serve packages --port=63372
Loading source assets...
Serving angular2.angular2_NgIf packages on http://localhost:63372
Build completed successfully
[packages] GET /angular2/src/reflection/reflection.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/reflection.dart
[packages] GET /angular2/src/reflection/reflection_capabilities.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/reflection_capabilities.dart
[packages] GET /angular2/angular2.dart => angular2.angular2_NgIf|packages/angular2/angular2.dart
[packages] GET /angular2/src/reflection/reflector.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/reflector.dart
[packages] GET /angular2/src/reflection/types.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/types.dart
[packages] GET /angular2/src/reflection/platform_reflection_capabilities.dart => angular2.angular2_NgIf|packages/angular2/src/reflection/platform_reflection_capabilities.dart
But now in Webstorm 11, this doesn't work anymore, as there is no packages
directory anymore.
I think it would be great if pub would support something like `pub serve
.` or maybe some convention like `pub serve dartpad` or `pub serve gist`.
This is just so that people can easily share code. So if someone at slack
ask, "hi all, how I could I setup oauth2 github authencitation with only
client side code in dart?"
Then I can just share this gist:
https://gist.github.com/kasperpeulen/ec3f3717f398ccce389e
Clone it in your editor, and it will run out of the box.
I'm trying to setup some kind of community driven dart cookbook, and this
website also uses gists as backend with the same convention as dartpad
(index.html/main.dart/styles.css).
I want to make sure every snippet on this website pass the following
quality standard: "every dartpad/gist will run directly out of the box in
your editor."
I can only make this promise, if dart allows to run a flat structure
--
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+***@dartlang.org.
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+***@dartlang.org.