Search code examples
htmlcssruby-on-rails-4helpndoc

Rails best way to work with third party generated html


I've done my rails page help documentation with the HelpNDoc help authoring tool. It generated a folder with some HTML pages and 4 more folders (js, img, css and lib). I'm looking for the best way for adding this functionality to my rails app.

So far I've tried to create a new controller called "help" and add the files to the view folder. After that I changed the application.js and application.css.scss files to add the js and css files. Turns out that the HTML files contain scripts, so I've placed them in the help.js file. This looks like the hardest solution since I have to look into the files to change references and other stuff.

Is there any other solution which doesn't involve changing a lot of things ?

Any help is appreciated.

My solution

I used an Engine (http://guides.rubyonrails.org/engines.html). I have to edit the html files to fix the routes but this is the cleanest solution.


Solution

  • HelpNDoc and other help authoring tools will generate static HTML content including: HTML, Javascript, CSS and possibly media elements. The best solution would be to host your documentation apart from your Rails app, on a static server or sub-domain such as help.yourapp.com

    The following tutorial might help you setup a sub-domain with static content alongside your Rails app: http://www.yearofmoo.com/2011/09/serve-precompiled-rails-assets-from-a-static-domain.html