2

Using Magento2, version 2.19

We are editing below file:

app/design/frontend/xx/xxxxx/Magento_Newsletter/templates/subscribe_popup.phtml

How can I show the changes to this file in the frontend of the site, without having to redeploy the static files from command line every time?

2 Answers 2

3

Yeah this can be done from within the below folder:

var/view_preprocessed/pub/static/app/design/frontend/vendor/theme

Modify the file within there and it will update instantly after a cache flush to remove any static block cache's or full page caches that the changes may also be stuck within. It's also worth updating the original files so they are not overwritten to the originals at any later static content deployment.

2
  • Very useful to know, saves another super slow re-deploy on production site....(!) I had a file (custom theme js) I needed to update, it wasn't in 'var/view_preprocessed/', instead it was in: 'pub/static/frontend/Vendor/theme/en_GB/js/...' Updating it here worked. What's the logic determining whether it ends up in 'var/view_preprocessed' or 'pub/static/', or both...?
    – 00-BBB
    Commented Sep 10, 2019 at 9:01
  • 1
    Yeah i think the JS files or anything in the web directories will end up in static although if you have merging on in production they will be in a merged JS file so modding the originals will not work. The view_preprocessed seems to be for template files like phtml of the top of my head.
    – harri
    Commented Sep 10, 2019 at 15:42
0

You don't need to run the setup:static-content:deploy commamd every time to show the changes of phtml file. If your theme is perfectly created and the cache is refreshed successfully, then your changes will be displayed in the frontend.

5
  • Ok, but they're not..... the file is being edited in the location detailed above. Cache is being cleared in normal fashion. So why are changes not appearing in frontend? I can only get the changes to occur is static content is redeployed as I say.
    – MagentoMac
    Commented Nov 9, 2017 at 19:17
  • Updated question to detail we are using Magento version 2, not Magento1!! Fairly obvious thing I forgot to mention.... long day.... should also have mentioned we have JS and CSS minified. Is that causing the issue? My understanding for Magento2 is that the files need to be edited in the /pub folder. If in app/design folder, then they need to be redeployed to be updated in frontend?
    – MagentoMac
    Commented Nov 9, 2017 at 19:21
  • Pub folder only consists css, images, js and fonts files. You need to run deploy command if only you add or edit css,js,images or fonts in app/design folder. If you are editing only phtml file then it doesn't need to run deploy command
    – user60655
    Commented Nov 9, 2017 at 19:24
  • Ok, so in this example, I am only editing the subscribe_popup.phtml file, so why is the frontend not updating after clearing cache? It's a theme file, not Magento core file. Tried clearing cache via Magento admin, and deleting cache folder in /var folder, but no change in frontend like I say
    – MagentoMac
    Commented Nov 9, 2017 at 19:32
  • This isn't the answer to this question and the question really still needs an answer. Have searched similar questions in this network, but nobody asking the exact same question and no answer out there as far as I can see. I think you need to redeploy the static content, but would like an answer either way to confirm from somebody who is 100% sure and can maybe even explain why?
    – MagentoMac
    Commented Nov 10, 2017 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.