spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
812 stars 256 forks source link

precompilation fails due to vendor/assets/javascripts/tinymce/plugins/example/dialog.html #184

Closed trushkevich closed 8 years ago

trushkevich commented 8 years ago

Hi, I use tinymce-rails 4.2.5 with rails 4.2.3 and here is what I get when I use config.tinymce.install = :compile:

$ RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
ExecJS::ProgramError: Unexpected token: operator (<) (line: 1, col: 0, pos: 0)

Error
    at new JS_Parse_Error (/tmp/execjs20150910-8786-wh58erjs:2359:10623)
    at js_error (/tmp/execjs20150910-8786-wh58erjs:2359:10842)
    at croak (/tmp/execjs20150910-8786-wh58erjs:2359:19086)
    at token_error (/tmp/execjs20150910-8786-wh58erjs:2359:19223)
    at unexpected (/tmp/execjs20150910-8786-wh58erjs:2359:19311)
    at expr_atom (/tmp/execjs20150910-8786-wh58erjs:2359:27526)
    at maybe_unary (/tmp/execjs20150910-8786-wh58erjs:2359:30019)
    at expr_ops (/tmp/execjs20150910-8786-wh58erjs:2359:30777)
    at maybe_conditional (/tmp/execjs20150910-8786-wh58erjs:2359:30869)
    at maybe_assign (/tmp/execjs20150910-8786-wh58erjs:2359:31312)
  (in /home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/tinymce-rails-4.2.5/vendor/assets/javascripts/tinymce/plugins/example/dialog.html)new JS_Parse_Error ((execjs):2359:10623)
js_error ((execjs):2359:10842)
croak ((execjs):2359:19086)
token_error ((execjs):2359:19223)
unexpected ((execjs):2359:19311)
expr_atom ((execjs):2359:27526)
maybe_unary ((execjs):2359:30019)
expr_ops ((execjs):2359:30777)
maybe_conditional ((execjs):2359:30869)
maybe_assign ((execjs):2359:31312)
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:39:in `exec'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:21:in `eval'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/execjs-2.6.0/lib/execjs/external_runtime.rb:46:in `call'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/uglifier-2.7.1/lib/uglifier.rb:212:in `run_uglifyjs'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/uglifier-2.7.1/lib/uglifier.rb:179:in `compile'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/uglifier_compressor.rb:25:in `evaluate'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/context.rb:197:in `block in evaluate'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:in `each'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:in `evaluate'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/bundled_asset.rb:25:in `initialize'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in `new'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in `build_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/index.rb:94:in `block in build_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/caching.rb:58:in `cache_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/index.rb:93:in `build_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/base.rb:287:in `find_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:in `find_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:211:in `block in find_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:257:in `benchmark'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:210:in `find_asset'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:119:in `block in compile'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in `each'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in `compile'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-2.12.4/lib/rake/sprocketstask.rb:146:in `with_logger'
/home/antoha/.rvm/gems/ruby-2.2.2@demingorg/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

when I remove the content of vendor/assets/javascripts/tinymce/plugins/example/dialog.html then precompilation works fine.

genaromadrid commented 8 years ago

Same here

spohlenz commented 8 years ago

I'm unfortunately unable to reproduce this, even when locking my gems to the ones I can deduce from your backtrace; and am at a bit of a loss as to what could be causing this.

Can you please let me know:

1) Your system configuration (i.e. OS and anything else you think could be relevant) 2) Does this happen on a brand new rails app with only the tinymce-rails gem? 3) Your Gemfile.lock and possibly your config/initializers/assets.rb if you have made any changes.

Thank you.

trushkevich commented 8 years ago

here is my Gemfile.lock

GEM
  remote: https://rubygems.org/
  remote: https://rails-assets.org/
  specs:
    actionmailer (4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.3)
      actionview (= 4.2.3)
      activesupport (= 4.2.3)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.3)
      activesupport (= 4.2.3)
      globalid (>= 0.3.0)
    activemodel (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
    activerecord (4.2.3)
      activemodel (= 4.2.3)
      activesupport (= 4.2.3)
      arel (~> 6.0)
    activesupport (4.2.3)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.3.8)
    angular-rails-templates (0.2.0)
      railties (>= 3.1)
      sprockets (~> 2)
      tilt
    angularjs-rails (1.4.4)
    arel (6.0.3)
    autoprefixer-rails (6.0.2)
      execjs
      json
    awesome_print (1.6.1)
    bcrypt (3.1.10)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-kaminari-views (0.0.5)
      kaminari (>= 0.13)
      rails (>= 3.1)
    bootstrap-sass (3.3.5.1)
      autoprefixer-rails (>= 5.0.0.1)
      sass (>= 3.3.0)
    brakeman (3.1.0)
      erubis (~> 2.6)
      fastercsv (~> 1.5)
      haml (>= 3.0, < 5.0)
      highline (~> 1.6)
      multi_json (~> 1.2)
      ruby2ruby (>= 2.1.1, < 2.3.0)
      ruby_parser (~> 3.7.0)
      sass (~> 3.0)
      slim (>= 1.3.6, < 4.0)
      terminal-table (~> 1.4.5)
    builder (3.2.2)
    byebug (5.0.0)
      columnize (= 0.9.0)
    capistrano (3.4.0)
      i18n
      rake (>= 10.0.0)
      sshkit (~> 1.3)
    capistrano-bundler (1.1.4)
      capistrano (~> 3.1)
      sshkit (~> 1.2)
    capistrano-passenger (0.1.1)
      capistrano (~> 3.0)
    capistrano-rails (1.1.3)
      capistrano (~> 3.1)
      capistrano-bundler (~> 1.1)
    capistrano-rvm (0.1.2)
      capistrano (~> 3.0)
      sshkit (~> 1.2)
    capistrano-sidekiq (0.5.3)
      capistrano
      sidekiq
    carrierwave (0.10.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
      mime-types (>= 1.16)
    celluloid (0.16.0)
      timers (~> 4.0.0)
    coderay (1.1.0)
    coffee-rails (4.1.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.9.1.1)
    colorize (0.7.7)
    columnize (0.9.0)
    connection_pool (2.2.0)
    daemons (1.2.3)
    database_cleaner (1.5.0)
    debug_inspector (0.0.2)
    devise (3.5.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    devise-bootstrap-views (0.0.5)
    diff-lcs (1.2.5)
    docile (1.1.5)
    dotenv (2.0.2)
    dotenv-rails (2.0.2)
      dotenv (= 2.0.2)
      railties (~> 4.0)
    el_finder (1.1.12)
      image_size (>= 1.0.0)
    erubis (2.7.0)
    eventmachine (1.0.8)
    execjs (2.6.0)
    factory_girl (4.5.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.5.0)
      factory_girl (~> 4.5.0)
      railties (>= 3.0.0)
    fastercsv (1.5.5)
    font-awesome-rails (4.4.0.0)
      railties (>= 3.2, < 5.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    haml (4.0.7)
      tilt
    highline (1.7.3)
    hike (1.2.3)
    hitimes (1.2.2)
    i18n (0.7.0)
    ice_cube (0.11.1)
    image_size (1.4.1)
    jbuilder (2.3.1)
      activesupport (>= 3.0.0, < 5)
      multi_json (~> 1.2)
    jquery-rails (4.0.4)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    kaminari (0.16.3)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    launchy (2.4.3)
      addressable (~> 2.3)
    letter_opener (1.4.1)
      launchy (~> 2.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    method_source (0.8.2)
    mime-types (2.6.1)
    mini_portile (0.6.2)
    minitest (5.8.0)
    multi_json (1.11.2)
    nested_form (0.3.2)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (2.9.2)
    nokogiri (1.6.6.2)
      mini_portile (~> 0.6.0)
    oj (2.12.10)
    orm_adapter (0.5.0)
    parallel (1.6.1)
    parallel_tests (1.6.2)
      parallel
    pg (0.18.3)
    pg_search (1.0.5)
      activerecord (>= 3.1)
      activesupport (>= 3.1)
      arel
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-byebug (3.2.0)
      byebug (~> 5.0)
      pry (~> 0.10)
    pry-rails (0.3.4)
      pry (>= 0.9.10)
    quiet_assets (1.1.0)
      railties (>= 3.1, < 5.0)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.3)
      actionmailer (= 4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      activemodel (= 4.2.3)
      activerecord (= 4.2.3)
      activesupport (= 4.2.3)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.3)
      sprockets-rails
    rails-assets-angular (1.4.5)
    rails-assets-angular-bootstrap (0.13.3)
      rails-assets-angular (>= 1.3.0)
    rails-assets-angular-strap (2.2.1)
      rails-assets-angular (>= 1.2.21, < 2)
    rails-assets-dropzone (4.0.1)
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    railties (4.2.3)
      actionpack (= 4.2.3)
      activesupport (= 4.2.3)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    redis (3.2.1)
    redis-namespace (1.5.2)
      redis (~> 3.0, >= 3.0.4)
    responders (2.1.0)
      railties (>= 4.2.0, < 5)
    rollbar (2.1.0)
    rspec-core (3.3.2)
      rspec-support (~> 3.3.0)
    rspec-expectations (3.3.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.3.0)
    rspec-mocks (3.3.2)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.3.0)
    rspec-rails (3.3.3)
      actionpack (>= 3.0, < 4.3)
      activesupport (>= 3.0, < 4.3)
      railties (>= 3.0, < 4.3)
      rspec-core (~> 3.3.0)
      rspec-expectations (~> 3.3.0)
      rspec-mocks (~> 3.3.0)
      rspec-support (~> 3.3.0)
    rspec-support (3.3.0)
    ruby2ruby (2.2.0)
      ruby_parser (~> 3.1)
      sexp_processor (~> 4.0)
    ruby_parser (3.7.1)
      sexp_processor (~> 4.1)
    sass (3.4.18)
    sass-rails (5.0.3)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (~> 1.1)
    sexp_processor (4.6.0)
    sidekiq (3.4.2)
      celluloid (~> 0.16.0)
      connection_pool (~> 2.2, >= 2.2.0)
      json (~> 1.0)
      redis (~> 3.2, >= 3.2.1)
      redis-namespace (~> 1.5, >= 1.5.2)
    sidetiq (0.6.3)
      celluloid (>= 0.14.1)
      ice_cube (= 0.11.1)
      sidekiq (>= 3.0.0)
    simplecov (0.10.0)
      docile (~> 1.1.0)
      json (~> 1.8)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    slim (3.0.6)
      temple (~> 0.7.3)
      tilt (>= 1.3.3, < 2.1)
    slim-rails (3.0.1)
      actionmailer (>= 3.1, < 5.0)
      actionpack (>= 3.1, < 5.0)
      activesupport (>= 3.1, < 5.0)
      railties (>= 3.1, < 5.0)
      slim (~> 3.0)
    slop (3.6.0)
    spring (1.3.6)
    sprockets (2.12.4)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.3.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    sshkit (1.7.1)
      colorize (>= 0.7.0)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    temple (0.7.6)
    terminal-table (1.4.5)
    thin (1.6.3)
      daemons (~> 1.0, >= 1.0.9)
      eventmachine (~> 1.0)
      rack (~> 1.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (1.4.1)
    timers (4.0.4)
      hitimes
    tinymce-rails (4.2.5)
      railties (>= 3.1.1)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.1)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    warden (1.2.3)
      rack (>= 1.0)
    web-console (2.2.1)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
  ruby

DEPENDENCIES
  angular-rails-templates (= 0.2.0)
  angularjs-rails (= 1.4.4)
  awesome_print
  bootstrap-kaminari-views (= 0.0.5)
  bootstrap-sass (= 3.3.5.1)
  brakeman (>= 3.0.0)
  byebug
  capistrano
  capistrano-bundler
  capistrano-passenger
  capistrano-rails
  capistrano-rvm
  capistrano-sidekiq
  carrierwave (= 0.10.0)
  coffee-rails (= 4.1.0)
  database_cleaner
  devise (= 3.5.1)
  devise-bootstrap-views (= 0.0.5)
  dotenv-rails (= 2.0.2)
  el_finder (= 1.1.12)
  factory_girl_rails
  font-awesome-rails (= 4.4.0.0)
  jbuilder (= 2.3.1)
  jquery-rails (= 4.0.4)
  kaminari (= 0.16.3)
  letter_opener
  nested_form (= 0.3.2)
  oj (= 2.12.10)
  parallel_tests
  pg (= 0.18.3)
  pg_search (= 1.0.5)
  pry-byebug
  pry-rails
  quiet_assets
  rails (= 4.2.3)
  rails-assets-angular-bootstrap (= 0.13.3)!
  rails-assets-angular-strap (= 2.2.1)!
  rails-assets-dropzone (= 4.0.1)!
  rollbar (= 2.1.0)
  rspec-rails
  sass-rails (= 5.0.3)
  sidekiq (= 3.4.2)
  sidetiq (= 0.6.3)
  simplecov
  slim-rails (= 3.0.1)
  spring
  thin (= 1.6.3)
  tinymce-rails (= 4.2.5)
  uglifier (= 2.7.1)
  web-console (~> 2.0)

BUNDLED WITH
   1.10.6

I doubt that the others things matter (but if it's interesting to you - I'm on ubuntu 14.04, as for 2) - I'll check it when I have time) as the error happens due to javascript parsing failure during precompilation as it's clear from ExecJS::ProgramError: Unexpected token: operator (<) (line: 1, col: 0, pos: 0) error message. Which is logical because JS parser of course doesn't expect to meet html tags in javascript code. So actually I think that the only relevant thing even from the Gemfile.lock is execjs (2.6.0).

Besides it's clear that the issue is caused by that dialog.html file as removing it helps. Even if the issue could be fixed by some changes to my local configuration I don't think that it's a good approach when some example file makes gem users adjust anything in their setup.

BTW, thanks for the gem! :-)

spohlenz commented 8 years ago

I've managed to track down the issue to a bug in angular-rails-templates. It looks like someone else has opened a pull request with a fix though -- https://github.com/pitr/angular-rails-templates/pull/113.