How to conditionally add code in head of Vue app
I just saw in the vue cli documentation that the index.html page is processed by webpack. This means I can use lodash template syntax to easily add tags in the head only on production
<head>
...
<%= process.env.NODE_ENV === 'production' ? '<script>...</script>' : '' %>
...
</head>
alternative method:
<% if(process.env.NODE_ENV === 'production') { %>
<script>...</script>
<% } %>