# How to use snippets in frontend js files?

**URL:** <https://forum.shopware.com/t/how-to-use-snippets-in-frontend-js-files/71125>\
**Category:** Programming (EN)\
**Created:** [24. November 2020 um 12:48 UTC](https://forum.shopware.com/t/how-to-use-snippets-in-frontend-js-files/71125 "2020-11-24T12:48:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)\
**Post date:** [24. November 2020 um 12:48 UTC](https://forum.shopware.com/t/how-to-use-snippets-in-frontend-js-files/71125/1 "2020-11-24T12:48:36Z")

</div>

How to use snippets in frontend js files?

---

<div class="post-metadata">

**Author:** ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)\
**Post date:** [24. November 2020 um 12:57 UTC](https://forum.shopware.com/t/how-to-use-snippets-in-frontend-js-files/71125/2 "2020-11-24T12:57:41Z")

</div>

if it’s used often: define a js-variable in base.html.twig for accessing.
