cancel
Showing results for 
Search instead for 
Did you mean: 

Default css files are formatting to default stage after using setup:upgrade command

Default css files are formatting to default stage after using setup:upgrade command

i have done some modifications in default CSS files like style-m.css and style-i.css.

if i do upgradation(setup:upgrade) modifications in css file are missing.

3 REPLIES 3

Re: Default css files are formatting to default stage after using setup:upgrade command

Hello @sekhar_n 

 

Run below commands after upgrade command:

php bin/magento setup:static-content:deploy

set the permission if required. 

 

 

Manish Mittal
https://www.manishmittal.com/

Re: Default css files are formatting to default stage after using setup:upgrade command

Manish,

My Problem is if i write a code like

.product-info-price .price:after {
content: '(Include GST)';
font-size: xx-small;
font-weight: 400;
margin-left: 10px;
} in magento default css files(styles-i and styles-m).

if i run setup:upgrade command the above code is removing from magento default css files automatically.

 

Re: Default css files are formatting to default stage after using setup:upgrade command

Hello @sekhar_n 

are you changing directly in pub folder?

 

You should not edit/modify files within pub/* or vendor/* directory. Pub is for deployment and vendor is for default structure, which you override via your template or custom modules. Instead:

  • create a new theme inside app/design/frontend/{vendor}/{yourTheme}/. You can use Blank or Luma theme. You can also create new theme which inherites from Blank (inheritance is defined within theme.xml). If you are already using some theme then skip this step.
  • edit .less within your theme so the changes stay visible and don't get replaced when clearing the cache or upgrading the system.
  • Use grunt to compile your .less into deployment files.
  • You can also setup sourcemaps to pin point your styling within the theme .less files so you can be more productive.

Some useful references:

This is the flowchart that how magento2 process css files (source: inchoo)
8zPWG.png

Manish Mittal
https://www.manishmittal.com/