Philippe Monnet
2010-May-08 23:43 UTC
Proposal for optional compilation and caching of Tilt templates
I gave Magnus'' excellent integration of Tilt a whirl today and really love it. It''s also cool because you can match different types of templates at the same time (e.g. Markaby + HAML). I found that while prototyping it would be nice to not have Camping compile and cache Tilt templates. So I used the new option capability and defined a :dynamic_templates option. e.g.: module TiltTest set :views, File.dirname(__FILE__) + ''/views'' set :dynamic_templates, true #... end I changed the Camping code to check for that option and only compile and cache if false. What do you think? Maybe we need a shorter or different name for the option? I checked in the changes in my fork: http://github.com/techarch/camping/commit/0152c606f286855ca7381c9394e9f05001d93764 Magnus, you might have some additional ideas for tweaking this feature. So feel free to add/alter and merge to your liking. Philippe -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20100508/4d2da5ff/attachment.html>
Magnus Holm
2010-May-09 00:03 UTC
Proposal for optional compilation and caching of Tilt templates
Thanks for testing it out ;) I agree: we can''t cache templates in development and you shouldn''t need to set an option for that, however we also want Camping to be speedy out-of-box. What about applying your patch, but also make bin/camping set :dynamic_templates to true if it''s not set already? If you want to force caching (or force not-caching) in your app, you simply set :dynamic_templates, true/false. And if you don''t, it compiles if you i.e. run it through a configuration.ru, but is dynamic with bin/camping. Best of both worlds? On May 9, 2010 12:43 AM, "Philippe Monnet" <ruby at monnet-usa.com> wrote: I gave Magnus'' excellent integration of Tilt a whirl today and really love it. It''s also cool because you can match different types of templates at the same time (e.g. Markaby + HAML). I found that while prototyping it would be nice to not have Camping compile and cache Tilt templates. So I used the new option capability and defined a :dynamic_templates option. e.g.: module TiltTest set :views, File.dirname(__FILE__) + ''/views'' set :dynamic_templates, true #... end I changed the Camping code to check for that option and only compile and cache if false. What do you think? Maybe we need a shorter or different name for the option? I checked in the changes in my fork: http://github.com/techarch/camping/commit/0152c606f286855ca7381c9394e9f05001d93764 Magnus, you might have some additional ideas for tweaking this feature. So feel free to add/alter and merge to your liking. Philippe _______________________________________________ Camping-list mailing list Camping-list at rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20100509/5b6d654d/attachment-0001.html>
Philippe Monnet
2010-May-09 20:10 UTC
Proposal for optional compilation and caching of Tilt templates
I just made the changes and merged up to the main Camping branch: I am now setting the new :dynamic_templates option when you run the camping server (only). Magnus I did not rebuild the official gem yet. Maybe you could do that. On 5/8/2010 6:03 PM, Magnus Holm wrote:> > Thanks for testing it out ;) > > I agree: we can''t cache templates in development and you shouldn''t > need to set an option for that, however we also want Camping to be > speedy out-of-box. > > What about applying your patch, but also make bin/camping set > :dynamic_templates to true if it''s not set already? > > If you want to force caching (or force not-caching) in your app, you > simply set :dynamic_templates, true/false. And if you don''t, it > compiles if you i.e. run it through a configuration.ru > <http://configuration.ru>, but is dynamic with bin/camping. Best of > both worlds? > >> On May 9, 2010 12:43 AM, "Philippe Monnet" <ruby at monnet-usa.com >> <mailto:ruby at monnet-usa.com>> wrote: >> >> I gave Magnus'' excellent integration of Tilt a whirl today and really >> love it. >> It''s also cool because you can match different types of templates at >> the same time (e.g. Markaby + HAML). >> >> I found that while prototyping it would be nice to not have Camping >> compile and cache Tilt templates. >> So I used the new option capability and defined a :dynamic_templates >> option. >> >> e.g.: >> >> module TiltTest >> set :views, File.dirname(__FILE__) + ''/views'' >> set :dynamic_templates, true >> >> #... >> end >> >> I changed the Camping code to check for that option and only compile >> and cache if false. >> What do you think? >> Maybe we need a shorter or different name for the option? >> >> I checked in the changes in my fork: >> http://github.com/techarch/camping/commit/0152c606f286855ca7381c9394e9f05001d93764 >> >> Magnus, you might have some additional ideas for tweaking this >> feature. So feel free to add/alter and merge to your liking. >> >> Philippe >> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org <mailto:Camping-list at rubyforge.org> >> http://rubyforge.org/mailman/listinfo/camping-list > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20100509/f3d07fa6/attachment.html>
Magnus Holm
2010-May-09 21:04 UTC
Proposal for optional compilation and caching of Tilt templates
Nice! Great to see some contributions to Camping. Still wondering what''s the best way to handle small releases. We could mark it as --prerelease on Gemcutter or keep having it on my server. I also don''t release 2.1 until we have at least some tests. Could just be a wrapper around the test/apps-directory which makes sure they run properly, but I want at least have *something*. // Magnus Holm On Sun, May 9, 2010 at 23:10, Philippe Monnet <ruby at monnet-usa.com> wrote:> I just made the changes and merged up to the main Camping branch: > I am now setting the new :dynamic_templates option when you run the camping > server (only). > > Magnus I did not rebuild the official gem yet. Maybe you could do that. > > On 5/8/2010 6:03 PM, Magnus Holm wrote: > > Thanks for testing it out ;) > > I agree: we can''t cache templates in development and you shouldn''t need to > set an option for that, however we also want Camping to be speedy > out-of-box. > > What about applying your patch, but also make bin/camping set > :dynamic_templates to true if it''s not set already? > > If you want to force caching (or force not-caching) in your app, you simply > set :dynamic_templates, true/false. And if you don''t, it compiles if you > i.e. run it through a configuration.ru, but is dynamic with bin/camping. > Best of both worlds? > > On May 9, 2010 12:43 AM, "Philippe Monnet" <ruby at monnet-usa.com> wrote: > > I gave Magnus'' excellent integration of Tilt a whirl today and really love > it. > It''s also cool because you can match different types of templates at the > same time (e.g. Markaby + HAML). > > I found that while prototyping it would be nice to not have Camping compile > and cache Tilt templates. > So I used the new option capability and defined a :dynamic_templates option. > > e.g.: > > module TiltTest > ??? set :views, File.dirname(__FILE__) + ''/views'' > ??? set :dynamic_templates, true > > ??? #... > end > > I changed the Camping code to check for that option and only compile and > cache if false. > What do you think? > Maybe we need a shorter or different name for the option? > > I checked in the changes in my fork: > http://github.com/techarch/camping/commit/0152c606f286855ca7381c9394e9f05001d93764 > > Magnus, you might have some additional ideas for tweaking this feature. So > feel free to add/alter and merge to your liking. > > Philippe > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >