File Change Not Picked Up

Hi @tpbradley

I have a script call in Body End that points to a js file in Resources and I noticed that any changes in that file are not being automatically picked up when previewing.

The only workaround right now is to remove the file and then put the file back, which is quite tedious.

Sorry, somehow missed your message. How are you updating the script in Resources?

I’m updating in a text editor and saving changes. Would be nice if nothing was cached and would instantly pick up any changes made to the file (at least when previewing).

Are you cracking open the document bundle and editing it from there?

No I’m not messing with the Elements bundle, I have a js file in resources and I’m editing it like a normal person by selecting it in the finder and editing it - lol

I think I’m overthinking it LOL. Do you edit an external copy of the file in a text editor, then remove the existing script from resources in the Elements app, and drag the new edited version in?

Any files added to the Resources area are stored in the Project and do not reference your original files on disk, so you can’t just edit them in the Finder.

You could use the new Code page feature if you want an editable JS file in your project.

Does that help?

Yes, that’s what I’m doing currently.

Yeah, using the new Code page as @dan suggested is the way I’d go for this. You could create a scripts folder at the root of the site and add a code page in there for your script.

I’m not sure if code page will work, but it crashed when I tried to setup one - just sent in a crash report. Is that code page easily extractable when I move to dev packs?

Ah yes, I’m pretty sure this crash only happens on macOS 13 - I’ll get that fixed up. I don’t think you’ll be able to create a code page until then.

To extract the code you’d just have to select the page in the project outline, then copy the content.

1 Like

@Bill We’ve just released an update that should fix the crash, can you give code pages a try and let us know if this works for you.

Thanks @tpbradley Adding a file in pages panel now works. You didn’t have to do this on the weekend, but it is appreciated.

Quick question, if I wanted to use that file temporarily , is there a path variable to a page file like this to use in the ‘Edit Extra Code’ locations ?

I don’t think you need a path variable, becuase you set the location of the page.

/code/yourfile.js

And here’s a working example…

Hope that helps.

1 Like