4

I'm running custom modules in my application. I don't understand how the files are called from pub/static folder from the respective theme. Can anyone explain me how this background process works? I know that all folders and files are auto generated and they are used across the application.

I would like to know how these auto generated files are connecting to the modules and how they are processing and working. Please explain me as in detail as possible, and if someone else had discussed the same topic earlier please provide me the link, so that I can have a look and understand.

5

When a browser loads a web page and requests a static view file such as a JavaScript, CSS, image file, or another page asset, the Magento application processes the requested file before it returns the file to the browser.

This processing can include searching for a not-found file in additional locations, file merging, and file minification.

The static view files deployment command enables you to write static files to the Magento file system when the Magento software is set for production mode.

The term static view file refers to the following:

“Static” means it can be cached for a site (that is, the file is not dynamically generated). Examples include images and CSS generated from LESS.

“View” refers to presentation layer (from MVC). Static view files are located in the /pub/static directory, and some are cached in the /var/view_preprocessed directory as well.

Static view files deployment is affected by Magento modes as follows:

The default and developer mode: Magento generates them on demand, but the rest are cached in a file for speed of access. The production mode: Static files are not generated or cached.

You must write static view files to the Magento file system manually using the command discussed in this topic; after that, you can restrict permissions to limit your vulnerabilities and to prevent accidental or malicious overwriting of files.

enter image description here

Developer mode only: When you install or enable a new module, it might load new JavaScript, CSS, layouts, and so on. To avoid issues with static files, you must clean the old files to make sure you get all the changes for the new module.

Source: Magento

  • So, once it goes to production mode, the files and folders of pub/static permission have to change to avoid vulnerabilities? – TS Guhan May 22 '17 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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