Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Bump Version, update README
Browse files Browse the repository at this point in the history
  * due to sprockets digest method, we are forced to use a workaround to allow
  "precompilation" of .dart files, see [non-stupid-digest-assets](https://github.com/alexspeller/non-stupid-digest-assets)
  and [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](rails/sprockets-rails#49)
  it is optionally (and automatically) available by adding `gem 'non-stupid-digest-assets', '>= 1.1', github: 'm0gg/non-stupid-digest-assets'
` to your Gemfile
  * added dart_app.js to precompile list
  * faced an issue with UglifyJs stackoverflowing with too large dart2js files
  • Loading branch information
m0gg committed Dec 4, 2014
1 parent fdf406b commit 08184e8
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ dart-rails
==========

### Changelog
v0.2.1 - 04. Dec. 2014:
* due to sprockets digest method, we are forced to use a workaround to allow
"precompilation" of .dart files, see [non-stupid-digest-assets](https://github.com/alexspeller/non-stupid-digest-assets)
and [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](https://github.com/rails/sprockets-rails/issues/49)
it is optionally (and automatically) available by adding `gem 'non-stupid-digest-assets', '>= 1.1', github: 'm0gg/non-stupid-digest-assets'
` to your Gemfile
* added dart_app.js to precompile list
* faced an issue with UglifyJs stackoverflowing with too large dart2js files

v0.2.0 - 08. Oct. 2014:
* dart-rails can now detect changes in dart code and its dependencies
* RailsUjs call is now in the initial dart_app.dart template
Expand Down Expand Up @@ -74,6 +83,41 @@ For a working sample check [m0gg/dart-rails-sample](https://github.com/m0gg/dart

### Compatibility

###### UglifyJs

Don't worry if you're experiencing a

```
ExecJS::ProgramError: RangeError: Maximum call stack size exceeded
```
This is exactly what it means, a stackoverflow of UglifyJs. According to
[RangeError: Maximum call stack size exceeded #414](https://github.com/mishoo/UglifyJS2/issues/414) UglifyJs is
massivly recursive and your dart2js file might have blown it. This happened to me with an AngluarDart application.
You may simply disable UglifyJs in the environment file.
```
...
# Compress JavaScripts and CSS.
# config.assets.js_compressor = :uglifier
...
```
###### assets:precompile + native .dart files
As of rails 4 we are facing a problem for the productive environments.
See [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](https://github.com/rails/sprockets-rails/issues/49)
You may optionally add this to your Gemfile
```
gem 'non-stupid-digest-assets', '>= 1.1', github: 'm0gg/non-stupid-digest-assets
```
this will enable a workaround for digesting the assets while precompiling dart files as
seen in [non-stupid-digest-assets](https://github.com/alexspeller/non-stupid-digest-assets) and
additionally rewrite the manifests to use the non-digest files.
###### ruby-dart_js
This gem is needed for the `dart2js` compiler compatibility.
Expand Down
1 change: 0 additions & 1 deletion dart-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Gem::Specification.new do |s|
s.add_dependency 'rails', '>= 4.0.0'
s.add_dependency 'ruby-dart2js', '~> 0.1.0'
s.add_dependency 'sprockets-rails', '>= 2.0.0'
s.add_dependency 'non-stupid-digest-assets'
end
2 changes: 1 addition & 1 deletion lib/dart/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Dart
module Rails
VERSION = "0.2.0"
VERSION = "0.2.1"
end
end
12 changes: 10 additions & 2 deletions lib/dart/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
require 'dart/rails/helper'
require 'dart/rails/generators/assets/generator'

require 'non-stupid-digest-assets'

module Dart
class Railtie < ::Rails::Railtie
Expand All @@ -22,14 +21,23 @@ class Railtie < ::Rails::Railtie
::Rails.application.config.assets.precompile << 'dart.js'
::Rails.application.config.assets.precompile << 'dart_app.js'

# [Optionally via: https://github.com/m0gg/non-stupid-digest-assets]
# do not digest .dart files
# digest during compilation breaks darts 'import' functionality
# currently sprockets-rails does not allow mixed procompilation of digest and non-digest assets
# see https://github.com/rails/sprockets-rails/issues/49
# workaround is a 51-liner gem 'non-stupid-digest-assets'
# https://github.com/alexspeller/non-stupid-digest-assets
#
NonStupidDigestAssets.whitelist << /.*\.dart/
begin
require 'non-stupid-digest-assets'
if defined? NonStupidDigestAssets
NonStupidDigestAssets.whitelist += [ /.*\.dart/, 'dart_app.js', 'dart_app' ]
end
rescue Exception => e
::Rails.logger.info 'No non-stupid-digest-assets support. You may face issues with native dart-support!'
end


# Register mime-types
app.assets.register_mime_type 'application/dart', '.dart'
Expand Down

0 comments on commit 08184e8

Please sign in to comment.