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

Commit 08184e8

Browse files
committed
Bump Version, update README
* 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
1 parent fdf406b commit 08184e8

File tree

4 files changed

+55
-4
lines changed

4 files changed

+55
-4
lines changed

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ dart-rails
22
==========
33

44
### Changelog
5+
v0.2.1 - 04. Dec. 2014:
6+
* due to sprockets digest method, we are forced to use a workaround to allow
7+
"precompilation" of .dart files, see [non-stupid-digest-assets](https://github.com/alexspeller/non-stupid-digest-assets)
8+
and [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](https://github.com/rails/sprockets-rails/issues/49)
9+
it is optionally (and automatically) available by adding `gem 'non-stupid-digest-assets', '>= 1.1', github: 'm0gg/non-stupid-digest-assets'
10+
` to your Gemfile
11+
* added dart_app.js to precompile list
12+
* faced an issue with UglifyJs stackoverflowing with too large dart2js files
13+
514
v0.2.0 - 08. Oct. 2014:
615
* dart-rails can now detect changes in dart code and its dependencies
716
* RailsUjs call is now in the initial dart_app.dart template
@@ -74,6 +83,41 @@ For a working sample check [m0gg/dart-rails-sample](https://github.com/m0gg/dart
7483

7584
### Compatibility
7685

86+
###### UglifyJs
87+
88+
Don't worry if you're experiencing a
89+
90+
```
91+
ExecJS::ProgramError: RangeError: Maximum call stack size exceeded
92+
```
93+
94+
This is exactly what it means, a stackoverflow of UglifyJs. According to
95+
[RangeError: Maximum call stack size exceeded #414](https://github.com/mishoo/UglifyJS2/issues/414) UglifyJs is
96+
massivly recursive and your dart2js file might have blown it. This happened to me with an AngluarDart application.
97+
You may simply disable UglifyJs in the environment file.
98+
99+
```
100+
...
101+
# Compress JavaScripts and CSS.
102+
# config.assets.js_compressor = :uglifier
103+
...
104+
```
105+
106+
###### assets:precompile + native .dart files
107+
108+
As of rails 4 we are facing a problem for the productive environments.
109+
See [Inability to compile nondigest and digest assets breaks compatibility with bad gems #49](https://github.com/rails/sprockets-rails/issues/49)
110+
111+
You may optionally add this to your Gemfile
112+
113+
```
114+
gem 'non-stupid-digest-assets', '>= 1.1', github: 'm0gg/non-stupid-digest-assets
115+
```
116+
117+
this will enable a workaround for digesting the assets while precompiling dart files as
118+
seen in [non-stupid-digest-assets](https://github.com/alexspeller/non-stupid-digest-assets) and
119+
additionally rewrite the manifests to use the non-digest files.
120+
77121
###### ruby-dart_js
78122
79123
This gem is needed for the `dart2js` compiler compatibility.

dart-rails.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ Gem::Specification.new do |s|
1919
s.add_dependency 'rails', '>= 4.0.0'
2020
s.add_dependency 'ruby-dart2js', '~> 0.1.0'
2121
s.add_dependency 'sprockets-rails', '>= 2.0.0'
22-
s.add_dependency 'non-stupid-digest-assets'
2322
end

lib/dart/rails/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Dart
22
module Rails
3-
VERSION = "0.2.0"
3+
VERSION = "0.2.1"
44
end
55
end

lib/dart/railtie.rb

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
require 'dart/rails/helper'
1010
require 'dart/rails/generators/assets/generator'
1111

12-
require 'non-stupid-digest-assets'
1312

1413
module Dart
1514
class Railtie < ::Rails::Railtie
@@ -22,14 +21,23 @@ class Railtie < ::Rails::Railtie
2221
::Rails.application.config.assets.precompile << 'dart.js'
2322
::Rails.application.config.assets.precompile << 'dart_app.js'
2423

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

3442
# Register mime-types
3543
app.assets.register_mime_type 'application/dart', '.dart'

0 commit comments

Comments
 (0)