I am currently working on an integration of Dart into the Rails Asset Pipeline.
Compilation is already working; .dart
files are compiled into .js
by the Asset Pipeline. However, there should also be an uncompiled .dart
version that can be interpreted by Dartium.
The usual way is that .dart
files are included in the html source with a type of "application/dart"
. Then there's dart.js, which replaces those .dart
files with the corresponding .js
version if the browser doesn't understand Dart, replacding foo.dart
with foo.dart.js
.
My problem is, that the asset pipeline is serving the compiled JavaScript version, even if the client requests foo.dart
. foo.dart
should serve the original, uncompiled version, only foo.dart.js
should be compiled.
Source for ruby-dart and dart-rails
Edit: I thought about just copying the raw .dart
files to the public folder, but that's not an option, since the source file that is seen by the Asset Pipeline might include other .dart
files, which are then compiled into one single .js
file. So, not all .dart
files would be copied.
The clean it removes the old versions of the precompiled assets while leaving the new assets in place. Show activity on this post. rake assets:clean removes compiled assets. It is run by cap deploy:assets:clean to remove compiled assets, generally from a remote server.
The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file.
The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB. Prior to Rails 3.1 these features were added through third-party Ruby libraries such as Jammit and Sprockets.
you can put your .dart files directly in public/assets/
You should only put assets you want to pre-process into app/assets/ (or vendor/assets/... etc.). The assets that you don't want pre-processed, can be put directly in public/assets/ folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With