Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Moved product JS to external file (mostly) #220

Merged
merged 7 commits into from Sep 3, 2014
Merged

Moved product JS to external file (mostly) #220

merged 7 commits into from Sep 3, 2014

Conversation

cshold
Copy link
Contributor

@cshold cshold commented Sep 2, 2014

  • Move majority of product.liquid JS into shop.js.liquid
    • In order to use shop.js.liquid cache'd selectors, the remaining JS is moved to theme.liquid so it runs after timber.init is fired.
    • Is it worth making a snippet, or does it look fine at the bottom of theme.liquid?
  • And removed some console.logs (blame @Tetsuro)

Update:

  • Moved selectors to new function so that it doesn't have to follow timber.init (therefor can be moved back to product.liquid)

cc/ @stevebosworth @mpiotrowicz

@@ -1083,7 +1081,6 @@ var ajaxifyShopify = (function(module, $) {
qty = parseInt( qtySelector.val().replace(/\D/g, '') );

var qty = validateQty(qty);
console.log('3: ' + qty);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😧

@@ -15,6 +15,17 @@ timber.cacheSelectors = function () {
}
};

timber.cacheProductSelectors = function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpiotrowicz Moved them to a new function. Now this function is called at the beginning of timber.productJS, which lets us move the initializing JS back to product.liquid.

@stevebosworth
Copy link
Contributor

looks good to me. much nicer!!

cshold added a commit that referenced this pull request Sep 3, 2014
Moved product JS to external file (mostly)
@cshold cshold merged commit b51da98 into i18n Sep 3, 2014
@cshold cshold deleted the product-js branch September 3, 2014 19:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants