Reputation: 21895
I have a simple web site using Rails 3.2. It's just a layout, a few views, some CSS, and very little JavaScript.
I'd like to generate static HTML files for the output of every URL in my site, and I'd like to dump them into some directory outside of my Rails project directory. So I'll have
[target directory]/index.html
[target directory]/products/my-category-1/index.html
[target directory]/products/my-category-2/index.html
[target directory]/products/my-category-3/index.html
[target directory]/products/my-category-1/my-product-1.html
[target directory]/products/my-category-1/my-product-2.html
[target directory]/products/my-category-1/my-product-3.html
[target directory]/products/my-category-2/my-product-1.html
[target directory]/products/my-category-2/my-product-2.html
[target directory]/products/my-category-2/my-product-3.html
[target directory]/products/my-category-3/my-product-1.html
[target directory]/products/my-category-3/my-product-2.html
[target directory]/products/my-category-3/my-product-3.html
Is there a gem or technique I can use for this?
Or maybe I should create a rake task which does a wget on each URL and writes the output to a target directory? I will have to also ensure CSS and JS files are also pulled down and included in the target directory.
Upvotes: 0
Views: 370
Reputation: 1776
You can modify your project using render_to_string
for views instead of the usual render
.
Then I guess a batch file just copying the generated files, your existing javascripts and css will do.
Upvotes: 1