How can I apply new changes when edit JS file in production?

I made some changes in JS files inside docker container on my running VPS. How can I apply new changes? I tried sv restart unicorn but it wasn’t work.

P/s: When I edit in my local computer, it apply instantly when I reload the page.

Deploy it as a Theme Component

2 Likes

image

I changed these files, can it possible to apply as a theme? Could you give me more details about that?

Thanks.

2 Likes

So there’s no way to re-build JS and it reflect instantly, like in local environment?

If you want managed and persistent changes to core code that live beyond a rebuild you have four options:

  • (maintain a) Fork (forget it, nasty amount of maintenance) - you’d only do this if you didn’t know about the next three options or were too lazy to learn about them :sleeping:
  • Plugin (Ruby & Rails, CSS, Javascript, templates & assets) - front end and back end.
  • Theme Component (JavaScript, CSS, Templates and assets) - front end only.
  • PR to core! :wink:

For you Theme Component appears to be the right approach. Put the time in to learn how to use them and you will be rewarded.

It may initially look like extra hassle but they are super convenient and you can update, enable and disable Theme Components online without rebuiding. Very handy! Currently the only main limitation they have is a lack of test support iirc.

4 Likes

After 4 hour struggling with it, I suddenly restart docker and it works!

Thanks for your support, Robert! :smiling_face_with_three_hearts:

1 Like

Yes but the changes will be wiped out if you rebuild.

2 Likes

You’ll be sorry if you don’t follow Robert’s advice and create a theme component.

1 Like