App reviews, troubleshooting, and recommendations
Hi guys,
I create an app block (using theme app extension) with the file/folder structure:
themes-app-extension
-- assets
---- my-css.css
---- my-javascript.js
-- blocks
---- app-block.liquid
-- locales
-- snippets
In the app-block.liquid I create the block setting in the block schema as below:
{% schema %}
{
"name": "My block",
"target": "section",
"stylesheet": "my-css.css",
"javascript": "my-javascript.js",
"templates": [
"collection", "index"
],
"settings": [
{
"id": "text_size",
"type": "number",
"label": "Text size",
"default": 15
}, {
"id": "icon_size",
"type": "number",
"label": "Icon size",
"default": 20
}
]
}
{% endschema %}
In app-block.liquid, I can get the app block setting by access the block object as below:
{{ block.settings.text_size }}
{{ block.settings.icon_size }}
But now I want to get the app block setting in javascript file, meaning my-javascript.js
Is there anyway to do this? I appreciate any help and suggestion.
Thanks
Solved! Go to the solution
This is an accepted solution.
@EddieLuong did you find an answer for this? I believ you'd want to write to a JS variable within your liquid template and then read that value from within your my-javascript.js file.
This is an accepted solution.
@EddieLuong did you find an answer for this? I believ you'd want to write to a JS variable within your liquid template and then read that value from within your my-javascript.js file.
Hi there, could you write an example of how did you do it? Thanks 🙂
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023