From 08184e8a1e8006bbada34fab691149d2b3a7dda6 Mon Sep 17 00:00:00 2001 From: Marcel Sackermann Date: Thu, 4 Dec 2014 22:15:42 +0100 Subject: [PATCH] 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](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 --- README.md | 44 +++++++++++++++++++++++++++++++++++++++ dart-rails.gemspec | 1 - lib/dart/rails/version.rb | 2 +- lib/dart/railtie.rb | 12 +++++++++-- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 75149cf..dafdf34 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/dart-rails.gemspec b/dart-rails.gemspec index 81ce5bd..db1372c 100644 --- a/dart-rails.gemspec +++ b/dart-rails.gemspec @@ -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 diff --git a/lib/dart/rails/version.rb b/lib/dart/rails/version.rb index 46aaa1c..4c4450f 100644 --- a/lib/dart/rails/version.rb +++ b/lib/dart/rails/version.rb @@ -1,5 +1,5 @@ module Dart module Rails - VERSION = "0.2.0" + VERSION = "0.2.1" end end diff --git a/lib/dart/railtie.rb b/lib/dart/railtie.rb index 7b9b987..f537c85 100644 --- a/lib/dart/railtie.rb +++ b/lib/dart/railtie.rb @@ -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 @@ -22,6 +21,7 @@ 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 @@ -29,7 +29,15 @@ class Railtie < ::Rails::Railtie # 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'