0

Rails 3.2 を使用した単純な Web サイトがあります。それは単なるレイアウト、いくつかのビュー、いくつかの CSS、そしてごくわずかな JavaScript です。

サイト内のすべての URL の出力用に静的 HTML ファイルを生成し、それらを Rails プロジェクト ディレクトリ以外のディレクトリにダンプしたいと考えています。だから私は持っています

[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

これに使用できる宝石やテクニックはありますか?

それとも、各 URL で wget を実行し、出力をターゲット ディレクトリに書き込む rake タスクを作成する必要がありますか? また、CSS および JS ファイルもプルダウンしてターゲット ディレクトリに含める必要があります。

4

1 に答える 1

1

render_to_string通常の の代わりに for ビューを使用してプロジェクトを変更できますrender。次に、生成されたファイルをコピーするだけのバッチファイルだと思います。既存のjavascriptとcssで十分です。

于 2013-08-22T06:39:32.033 に答える