spohlenz / tinymce-rails

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

Add possibility to only load certain plugins and languages via config #24

Closed tvdeyen closed 13 years ago

tvdeyen commented 13 years ago

One should have the possibility to set which plugins and languages to be used. So that only these gets processed via the asset pipeline.

Please have a look into my fork of the tinymce_hammer plugin, which has this feature, but is not Rails 3.1 ready.

Maybe we could join forces and merge this feature from tinymce_hammer into your gem? That would be great since you already made all the rails 3.1 stuff I have to do now, just for having this one really nice feature.

Please let me know if I could help you with this.

Regards, Thomas

spohlenz commented 13 years ago

Firstly, sorry for the delay in replying.

As far as I am aware, the unused plugins/themes/languages don't actually get loaded or processed by the asset pipeline, so I'm not sure if there's a benefit there. In development mode, the files are only processed on access, and when precompiling, tinymce-rails bypasses the asset pipeline entirely.

Having said that, I am open to adding in some basic form helpers (and form builder methods), which could have their default options set in an initializer, similar to what you've done in tinymce_hammer.

I believe only one config option should be necessary -- a hash that is passed to tinyMCE.init(). What was your rationale in splitting out plugins and languages as separate options?

Are there any other issues you found in writing the helpers for tinymce_hammer?

tvdeyen commented 13 years ago

Sorry, for replying so late.

I am not using tinymce_hammer any more. I ported the necessary parts into my engine.

For that asset pipeline precompiling thing:

I do not understand why you not processing them with the precompilers. Its working good for me. I also only using the langs and plugins I am really needing:

https://github.com/magiclabs/alchemy_cms/tree/next_stable/vendor/assets/javascripts/tiny_mce

And added them to my precompiable assets:

https://github.com/magiclabs/alchemy_cms/blob/next_stable/lib/alchemy/engine.rb#L21

I even have custom plugins that are precompiled well:

https://github.com/magiclabs/alchemy_cms/tree/next_stable/app/assets/javascripts/tiny_mce/plugins

For me the assets pipeline is handling everything very well.

What issues do you have?

spohlenz commented 13 years ago

Bypassing the asset pipeline was done as a performance optimization. Because the TinyMCE javascripts come pre-minified, there is no need to re-process them through the asset pipeline. In my tests, the optimization shaves maybe 50% off the precompile step, which leads to much quicker deployments.

For development mode, and for custom plugins/themes/language packs, the asset pipeline is still used.