So I recently noticed that in some Magento 2 modules, there are two different template folders:

enter image description here

  • the view/frontend/templates contains .phtml files and I know that this pretty much matches the M1 app/design/frontend/<package>/<theme>/templates folder for each module.
  • the view/frontend/web/template contains .html files

My questions are:

  • What is that second folder used for ?
  • And more specifically, why aren't those files in the first folder ?
  • Or, if I reword that, what is the reason why there are two different templates folders ?

This question is an overall architectural question. It is not regarding the specific content of a given theme.

  • 1
    Re edit: The answers of the linked question do answer you question. To be more precise: The html files must be accessible from the web (through AJAX calls), that's why they are in "web". PHTML templates on the other hand should not be exposed to the public (i.e. pub/static) Dec 7, 2016 at 13:33
  • @fschmengler I agree that KAndy's answer does apply here. I also believe that the linked question is specifically about how to change minicart content and a discrepancy with the documentation, not an overall architectural question.
    – ryanF
    Dec 7, 2016 at 21:44