Skip to main content

Magento 2: How to Deploy static content using command line

First open the terminal and login with SSH and go to your project root directory, and then run following commands one by one:

  • rm -rf var/ pub/static/*
  • php bin/magento setup:static-content:deploy -f
  • php bin/magento cache:clean
  • chmod -R 777 var/ pub/ generated/

Comments

Popular posts from this blog

Magento 2: How to add custom script to head tag?

There are two ways to add custom script to head tag in Magento 2: add custom script through admin-panel add custom script through XML If you want to add custom script in head tag through admin-panel, just login to the admin and browse the navigation Content => Design => Configuration , Now click on edit link of current theme and Go to HTML Head tab and inside scripts and style sheets text-area you can enter your custom script.  If you want to add custom script through XML, just create a XML file on following location: app/design/frontend/packagename/themename/Magento_Theme/layout/default_head_blocks.xml and add the following code in this XML to call template file: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body>         <referenceBlock name="head.additional">    ...

Magento 2: How to add menu to the admin grid?

To add new menu in admin grid, first create an menu.xml file to your module on following location: Packagename/Modulename/etc/adminhtml/menu.xml then place the following code in menu.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">     <menu>          <add id="Packagename_Modulename::urlkey" title="Menu Title" module="Packagename_Modulename"  sortOrder="10" resource="Packagename_Modulename::urlkey"/>        <add id="Packagename_Modulename::urlkey_controller_action" title="Sub Menu Title" module="Packagename_Modulename"  sortOrder="10" action="urlkey/controller/action" resource="Packagename_Modulename::urlkey_controller_action" parent="Packagename_Modulename::urlkey" />     </menu> </config> ...

Magento 2: Print Invoice PDF or Shipment PDF is not working : sh: 1: xvfb-run: not found

Some times in Magento 2, while we try to print Invoice PDF or Shipment PDF or any other PDF, then it displays following message: sh: 1: xvfb-run: not found To resolve this issue, first login to your project through SSH and run following commands on the root location of your project: sudo apt-get install --fix-missing -y xvfb sudo apt-get update sudo apt-get install xvfb libfontconfig wkhtmltopdf