Part 10: Deploy static view files

Welcome to our serial articles on Magento 2 Command Lines (CLI)!

You know Magento 2 has provided the powerful command-line interface tool (CLI). It allows you to perform tasks including installation, configuration, database backups, compiling LESS etc. Today I will show you how to deploy the static view files in Magenot 2. Before starting this guide, please review our previous posts.

What is static view file?

Static view files are the files in presentation layer of Magento 2. They are cached at [Magento_Folder]/pub/static

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

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

Deploy static view files

  • Use command below to deploy static view files in Magento 2
php bin/magento setup:static-content:deploy <lang> … <lang> [–dry-run] 
  • Let I explain the parameters in this command
Param Description Required
lang Space-separated list of ISO-636 language codes for which to output static view files. (Default is en_US.)

You can find the list by running magento info:language:list.

no
–dry-run View the files output by the tool. no
  • Deploy static view files fo en_US
php bin/magento setup:static-content:deploy en_US
  • After run command above, you got the message from Magento
Requested languages: en_US

=== frontend -> Magento/luma -> en_US ===

… progress indicator …

Successful: 1613 files; errors: 0
=== frontend -> Magento/blank -> en_US ===

… progress indicator …

Successful: 1620 files; errors: 0
=== adminhtml -> Magento/backend -> en_US ===

… progress indicator …

Successful: 1626 files; errors: 0
=== Minify templates ===

… progress indicator …

Successful: 858 files modified

New version of deployed files: 1430774973

 

How to Override a Template File in Magento 2
How to Override REST Authentication

Leave a Reply

Your email address will not be published. Required fields are marked *