Freezing the Vue.js version to a minor version
Published on 2020-01-23 • Modified on 2020-01-23
This is a small trick that allows the jsdelivr.net CDN network. It's a very bad practice to use the "last" stable available version of a library. Instead, when getting a file, you can specify a tag. The trick here is to set a minor version (eg: 2.6) instead of setting an exact version (eg: 2.6.11). When using 2.6, the last bugfix version will be used so you are sure there no compatibility problem with your code. While developing, we can continue to use the last not minified version. The Twig is_dev()
helper test if we are on a local development machine and not in production.
{% if is_dev() %}
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
{% else %}
<script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script>
{% endif %}
More on Stackoverflow More on the web Random snippet
Call to action
Did you like this post? You can help me back in several ways: (use the "reply" link on the right to comment or to contact me )
- Report any error/typo.
- Report something that could be improved.
- Like and repost!
- Follow me on Bluesky 🦋
- Subscribe to the RSS feed.
- Click on the More on Stackoverflow buttons to make me win "Announcer" badges 🏅.
Thank you for reading! And see you soon on Strangebuzz! 😉
