spohlenz / tinymce-rails

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

Default plugins and translations are not precompiled #21

Closed v-yarotsky closed 11 years ago

v-yarotsky commented 12 years ago

I'm migrating to rails 3.1.0 and decided to use tinymce-rails 3.4.6. It works fine in "development" environment, but it is not usable in "production" environment, however. I have //= require tinymce-jquery in my application.js. rake assets:precompile "successfully" executes, but when I start server in production mode, it complains that it can't find tinymce/langs/en.js?3.4.6, tinymce/themes/advanced/editor_template.js?3.4.6, tinymce/plugins/autosave/editor_plugin.js?3.4.6, etc. I can see gzipped tinymce-rails.js and some other related files in public/assets directory, but there is no gzipped version of those editor_plugin.js files. Is there any way to fix this? Thanks

spohlenz commented 12 years ago

Are the non-gzipped versions of those files there? I may need to add in an extra step in the precompile process to add those, since tinymce-rails uses a custom assets:precompile.

v-yarotsky commented 12 years ago

Non-gzipped files are present. Is there any chance that the problem occurs because of config.serve_static_assets = false in my environments/production.rb? I forgot to mention that I'm running application on my machine via unicorn -E production

spohlenz commented 12 years ago

tinymce-rails pretty much just does a straight copy of the TinyMCE assets when you run assets:precompile to avoid expensive recompilation of the already minified assets (https://github.com/spohlenz/tinymce-rails/blob/master/lib/tinymce/assets.rake).

Does unicorn not serve the non-gzipped assets by default or is that a custom setting?

sekrett commented 12 years ago

There was a bug in Rails 3.1.0 concerning assets precompile. Try Rails 3.1.1, possibly it will solve your case.

jonas-jasas commented 12 years ago

Getting these errors on production: GET http://server/assets/tinymce/langs/en.js?3.4.7 404 (Not Found) application-f5c29f4da1ebb5ccbb333097a9b986c1.js:27 Failed to load: http://server/assets/tinymce/langs/en.js GET http://server/assets/tinymce/themes/advanced/editor_template.js?3.4.7 404 (Not Found) application-f5c29f4da1ebb5ccbb333097a9b986c1.js:27 Failed to load: http://server/assets/tinymce/themes/advanced/editor_template.js

On development everything is fine. Using Rails 3.1.1 Is this a bug or I do something wrong?

spohlenz commented 12 years ago

@jasajona I assume you've run rake assets:precompile?

jonas-jasas commented 12 years ago

I did: bundle exec rake assets:precompile now everything seams fine. Thank you!

davidkennedy-examtime commented 12 years ago

Update: I'm moving this to new issue, it's clearly not the same as the current issue, and it's just confusing to do this in a comment. Important: the new issue is https://github.com/spohlenz/tinymce-rails/issues/30 and it's Closed as it was entirely human error on my part.


I am having a similar issue to @jasajona, but it is not solved by precompiling.

I'm using Rails 3.1.0, and Ruby 1.9.3. In development mode, everything is working fine, but in production mode, I seem unable to load precompiled tinymce assets. However, the assets are in my public/assets directory as expected. The page with the tinymce textareas does not render any textareas. Command and logs:

bin/rake assets:precompile
RAILS_ENV=production bin/rails server thin

Started GET "/assets/tinymce/themes/advanced/editor_template.js?3.4.7" for 10.0.2.2 at 2012-01-07 16:09:06 +0000 
Served asset /tinymce/themes/advanced/editor_template.js - 404 Not Found (4ms)
ActionController::RoutingError (No route matches [GET] "/assets/tinymce/themes/advanced/editor_template.js"):

ls -l public/assets/tinymce/themes/advanced/editor_template.js 
-rw-r--r-- 1 dkennedy dkennedy 25166 2012-01-07 16:06 public/assets/tinymce/themes/advanced/editor_template.js

I am unclear if this is a routing issue on my part, but I don't see anything in the documentation about needing to tweak config/routes.

Any advice?

erichjrusch commented 12 years ago

I'm experiencing the same issues as @davidkennedy-examtime and @jasajona.

Failed to load: http://localhost:3000/assets/tinymce/langs/en.js tiny_m...?body=1 (line 7811) Failed to load: http://localhost:3000/assets/tinymce/themes/advanced/editor_template.js

The pre compilation happens successfully. The assets from the gem folder are copied correctly to my assets folder in the public/assets of the rails app. I can see the files when I look through my file system on finder and in terminal, however it seems that for some reason the browser is unable to access them.

Is there an additional configuration step that I am missing?

spohlenz commented 12 years ago

@ejrusch Try enabling config.serve_static_assets. I don't think thin serves static assets (files in public) by default.