Have you ever tried to track down which piece of javascript modified the DOM?
Use a mutationObserver to monitor the DOM for changes. Then run console.trace() inside the callback. This will log a stack trace all the way back to the code that did the DOM modification.
Basically copy and paste this code.
| # ================================ Customizable Settings ================================ | |
| # ================================================================ | |
| # Show Rate(s) for Product Tag | |
| # | |
| # If we have a product with matching tag, the entered rate(s) will be | |
| # shown, and all others will be hidden. Otherwise, the entered | |
| # rate(s) will be hidden. | |
| # | |
| # - 'product_tag_match_type' determines whether we look for the | |
| # product to be tagged with any of the entered tags or not. |
| (function () { | |
| if (!document.querySelector && !window.addEventListener && !("classList" in document.createElement("p"))) return; | |
| var ready = function (callback, ctx) { | |
| if (typeof callback !== 'function') return; | |
| if (document.readyState !== "loading") { | |
| callback.apply(ctx); | |
| } else { | |
| document.addEventListener("DOMContentLoaded", function () { |
| {% comment %} | |
| *** MAKE SURE TO REMEMBER TO SET THE DEFAULT GALLERY ID *** | |
| {% endcomment %} | |
| {% if section.settings.product-gallery-id != blank and section.settings.enable-product-gallery %} | |
| <div class="showcase-product-gallery"> | |
| {% if section.settings.product-gallery-title != blank %} | |
| <h2>{{section.settings.product-gallery-title}}</h2> | |
| {% endif %} | |
| <script src="https://showcase.abovemarket.com/embed/gallery/{{section.settings.product-gallery-id}}" |
Track the last collection by storing or updating a cookie on every collection page visit. If it comes across a continue shopping link then it updates that link to point back to that last collection.
Add the attribute data-continue-shopping-link to any link you want to act as a continue shopping link.
Requires the current template to be passed to it from liquid:
| .description-tab__header { | |
| padding-top: 1.5em; | |
| .no-js &:first-child { | |
| padding-top: 0; | |
| } | |
| } | |
| .has-tabs { | |
| .description-tabs { | |
| position: relative; | |
| @include display-flexbox(); |
The scripts portion of a package.json file used for Shopify theme development.
To run use the command npm run build.
Watch and build JS files in the _src/js/ folder.
This will create a minified file and a debug version (including a sourcemap) for development, and add them to the assets folder.
We also watch for changes the main theme.js file in the assets folder and then minify this for production.
| {% comment %} | |
| Title case a string of text. | |
| Usage: {% include 'title-case' string: 'my string' %} | |
| {% endcomment %} | |
| {%- capture str -%}{%- endcapture -%} | |
| {%- assign small_words = 'a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs|vs.|via|with' | split:'|' -%} | |
| {%- assign string_parts = string | split: ' ' -%} | |
| {%- for p in string_parts -%} | |
| {%- assign is_small = false -%} |
| {% comment %} | |
| Remove orphans from a string of text by adding a non-breaking space between the last two words. | |
| Usage: {% include 'adopt' string: 'my string' %} | |
| {% endcomment %} | |
| {%- assign string_parts = string | split: ' ' -%} | |
| {%- assign last_part = string_parts | last -%} | |
| {% if last_part contains ' ' %} | |
| {{ string }} | |
| {% else %} |
| {% capture func %} | |
| {% comment %} | |
| Scan String: | |
| Scan a string looking for things | |
| Parameters: | |
| Content: the content to be scaned | |
| Split: the item to split the string with | |
| Start: the thing that says we can start collecting |