13

2025

-

10

Shopify 模板查询

直接粘到浏览器 控制台 运行的 JavaScript 脚本。它会用多种启发式方法去检测当前 Shopify 商店使用的主题


作者:

来源:

(() => {
 const info = (window.Shopify && Shopify.theme) || {};
 const assets = [...document.querySelectorAll('link[rel="stylesheet"],script[src]')]
   .map(n => n.href || n.src).filter(Boolean);

 const paths = assets.map(u => new URL(u, location.origin).pathname);

 const has = (re) => paths.some(p => re.test(p));
 const hints = paths.filter(p => /\/cdn\/shop\/t\/\d+\/assets\/|component-|section-|template-|global|pubsub|constants|animations/i.test(p));

 const heuristic = {
   dawn_family_core: has(/\/cdn\/shop\/t\/\d+\/assets\/(global|pubsub|constants|animations)\.js/i),
   has_components:   has(/component-|section-|template-/i),
   has_loop_app:     paths.some(p => /\/script_tags\/loop_snippets/i.test(p)),
 };

 console.table({
   theme_name: info?.name || null,
   theme_id: info?.id || null,
   schema_name: info?.schema_name || null,
   schema_version: info?.schema_version || null,
   theme_store_id: info?.theme_store_id ?? null,
   role: info?.role || null,
   dawn_family_match: heuristic.dawn_family_core ? 'yes' : 'no',
   loop_app_detected: heuristic.has_loop_app ? 'yes' : 'no'
 });

 console.log('Asset hints (top 40):', hints.slice(0, 40));
})();