punch icon indicating copy to clipboard operation
punch copied to clipboard

include snippet only during punch generate

Open constantx opened this issue 11 years ago • 2 comments

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.

constantx avatar Sep 11 '13 22:09 constantx

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.

laktek avatar Sep 14 '13 04:09 laktek

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.

bjfish avatar Oct 19 '13 02:10 bjfish