you can use wcmmode to determine the whether the page is loading in publish or not . can you try with below code snippet? <sly data-sly-test=${wcmmode.disabled}>
// include scripts to load on publish
<script type="text/javascript" src="//<path here>"></script>
<script type="text/javascr...