Any edits made to theme.js are not reflected to the website at all

Solved

Any edits made to theme.js are not reflected to the website at all

Darkbound
Tourist
7 0 0

So I found a bug in the theme that I am using and I've been trying to track it and then attempt to fix it.

The problem is that, no matter what code I write in theme.js it is never ever executed, its like, its never updated to the website.

A simple example that I will show you is the following: http://prntscr.com/1qoek29

As you can see I have added a console.log("WTF") right next to the console.log of the theme that prints the theme name and version, and yes, I have tried that with a fresh incognito window, plus by now its been over 30 minutes since I did the edit, and I still can't see it, so no matter what other changes I do to theme.js they never reflect on the actual website, and I can't figure out why that is.

Accepted Solution (1)

Guleria
Shopify Partner
4058 797 1146

This is an accepted solution.

Hello @Darkbound ,

Are you sure the theme you are using use theme.js file?

I think it's not and you have to confirm it from source code. 
btw try to add your code console.log("WTF") in theme.min.js 

Thanks

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

View solution in original post

Replies 6 (6)

Guleria
Shopify Partner
4058 797 1146

This is an accepted solution.

Hello @Darkbound ,

Are you sure the theme you are using use theme.js file?

I think it's not and you have to confirm it from source code. 
btw try to add your code console.log("WTF") in theme.min.js 

Thanks

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Darkbound
Tourist
7 0 0

Hey Guleria, thanks for the suggestion, I have just tried it, and yes, modifications in the theme.min.js file do work.

Now the question becomes, how do I transfer my modifications from the "normal" theme.js file into the minified one? How do I 'reminify' it? 

 

EDIT: I found it in theme.liquid and changed it from .min.js to the normal theme.js file, and now the console.logs are working and I am guessing I can start digging in for the issue.

My question now becomes, is this the "acceptable" way to do what I want to do? Work on the theme.js, minify it by myself once I am done, and replace the theme.min.js? 

Guleria
Shopify Partner
4058 797 1146

Great, you can use unminify or use online tools to minify it like https://javascript-minifier.com/

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Darkbound
Tourist
7 0 0

My question now becomes, is this the "acceptable" way to do what I want to do? Work on the theme.js, minify it by myself once I am done, and replace the theme.min.js? 

Guleria
Shopify Partner
4058 797 1146

Yes, no one is going to stop you hahaha
btw write down your changes somewhere so at the time to update the theme you can copy your changes easily to updated theme.
Thanks

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
NiklasF
Visitor
1 0 0

Is there an easier way to keep file modifications if I want to update my theme? I way thinking of something like a child file, like theme-child.js that contains all my changes I did to the theme.js and that stays the same if I update?