laktek / punch

A fun and easy way to build modern websites
http://laktek.github.com/punch
MIT License
1.17k stars 107 forks source link

include snippet only during punch generate #100

Open constantx opened 10 years ago

constantx commented 10 years ago

Is there a way to include a snippet only during punch generate? I need to include a certain snippet only when the site is build.

laktek commented 10 years ago

Can you explain bit more about the use case?

If your snippet is a plugin, you can create a property for it config.json and toggle it between development/generation.

bjfish commented 10 years ago

I think this could be useful for example including/excluding Google Analytics code which you would only want after statically generating.

{{#static_only}}
<script><!-- GA Code here --></script>
{{#static_only}}

or inversely

{{#dynamic_only}}
<!-- Debug only Code -->
{{/dynamic_only}}

I'm not sure if this is what the OP meant.