shopify中的settings_data.json和settings_schema.json之间有什么区别

时间:2016-12-26 20:54:19

标签: json shopify

shopify中settings_data.json和settings_schema.json文件之间的区别是什么,我可以通过两者设置主题设置,但我会在什么时候使用哪一个?我在下面给出一个示例,其中显示了Setting_schema.json文件和Setting_data.json文件,但我可以理解两者都在管理部分中创建相同的功能。但那之间有什么区别。为什么shopify主题使用了两种类型设置json文件?

/**Here is Setting_schema.json file :**/

[
  {
    "name": "theme_info",
    "theme_name": "Minimal",
    "theme_author": "Shopify",
    "theme_version": "1.0",
    "theme_documentation_url": "https:\/\/docs.shopify.com\/manual\/more\/official-shopify-themes\/minimal",
    "theme_support_url": "https:\/\/support.shopify.com\/"
  },
  {
    "name": "Layout",
    "settings": [
      {
        "type": "checkbox",
        "id": "enable_wide_layout",
        "label": "Enable wide layout"
      }
    ]
  },
  {
    "name": "Colors",
    "settings": [
      {
        "type": "header",
        "content": "Background"
      },
      {
        "type": "checkbox",
        "id": "theme_bg_image",
        "label": "Use theme background"
      },
      {
        "type": "image_picker",
        "id": "bg_custom",
        "label": "Custom image"
      },
      {
        "type": "radio",
        "id": "bg_image_display",
        "label": "Image display",
        "options": [
          {
            "value": "tile",
            "label": "Tile"
          },
          {
            "value": "stretch",
            "label": "Stretch"
          }
        ]
      },
      {
像这样......

/**And Here is Schema_data.json code:**/

{
  "current": {
    "enable_wide_layout": false,
    "theme_bg_image": false,
    "bg_custom": "",
    "bg_image_display": "tile",
    "color_topbar_bg": "#eeeeee",
    "color_body_bg": "#ffffff",
    "color_footer_bg": "#eeeeee",
    "color_borders": "#dddddd",
    "color_primary": "#ab094b",
    "color_button_primary_text": "#ffffff",
    "color_secondary": "#767676",
    "color_button_secondary_text": "#ffffff",
    "color_topbar_text": "#a8003e",
    "color_header_text": "#595556",
    "color_body_text": "#5b5252",
    "color_footer_text": "#555555",
    "color_footer_social_link": "#555555",
    "type_base_family": "'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif",
    "type_base_size": "16px",
    "type_header_family": "Google_PT+Serif_700_serif",
    "type_header_size": "36px",
    "type_accent_family": "Google_Lato_400_sans",
    "type_accent_size": "16px",
    "type_accent_transform": false,
    "type_accent_spacing": false,
    "favicon": "shopify:\/\/shop_images\/color_transparent_500px_81b18ab4-183c-480f-ba6a-529b0e9e665c.png",
    "social_twitter_link": "",
    "social_facebook_link": "",
    "social_pinterest_link": "",
    "social_google_plus_link": "",
    "social_instagram_link": "",
    "social_snapchat_link": "",
    "social_tumblr_link": "",
    "social_youtube_link": "",
    "social_vimeo_link": "",
    "social_fancy_link": "",
    "social_rss_link": "",
    "share_facebook": true,
    "share_twitter": true,
    "share_pinterest": true,
    "social_sharing_style": "normal",
    "checkout_header_image": "",
    "checkout_logo_image": "shopify:\/\/shop_images\/color_transparent_500px_e0d779f9-b33c-47b1-bb14-fb8fde7411d7.png",
    "checkout_logo_position": "left",
    "checkout_logo_size": "medium",
    "checkout_body_background_image": "",...........

像这样作为例子

我可以在管理面板中看到两个输出主题设置选项那么它们之间有什么区别?

shopify中settings_data.json和settings_schema.json文件之间的区别是什么,我可以通过两者设置主题设置,但我会在什么时候使用哪一个?我在下面给出一个示例,其中显示了Setting_schema.json文件和Setting_data.json文件,但我可以理解两者都在管理部分中创建相同的功能。但那之间有什么区别。为什么shopify主题使用了两种类型设置json文件?

2 个答案:

答案 0 :(得分:1)

模式文件用于为您的主题生成/创建/编辑选项,这些选项将显示在用户的主题界面中。它是您用来创建选项的那个(设置所有参数,如ID,类型,标签等......)。

数据文件正在记录所有选项值。它是JSON中的一种数据库。它可能用于直接在主题中修改选项值或主题预设,而无需使用用户界面。

Schema管理用户设置的密钥和数据存储值。

答案 1 :(得分:0)

来自 Shopify 帖子:link

settings_schema.json 对比 settings_data.json

settings_schema.json 文件控制主题编辑器中商家可用的组织和选项。它用于创建和编辑主题内商家可用的主题设置。主题设置遵循 Shopify 文档中概述的指定文件格式。

settings_data.json 文件存储从主题编辑器保存的主题设置数据。它还可以包括“主题样式”,也称为预设。如果定义了预设,则商家可以选择主题开发者预先确定的主题风格。然后,主题样式为 settings_schema.json 文件中定义的键设置特定值。