Suraj Gautam
Suraj Gautam

Reputation: 21

Magento 2: File path for changes in css

I am new to magento 2 and I am making css changes in luma theme on below path.

But after content deployment I lost my css changes. Please help me in that.

/pub/static/frontend/Magento/luma/en_US/css/styles-m.css /pub/static/frontend/Magento/luma/en_US/css/styles-l.css

Upvotes: 1

Views: 2535

Answers (1)

Manthan Dave
Manthan Dave

Reputation: 2157

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.

if you want to override only css file then you don't need to compile it. so follow above steps , change your css and clear the cache. it will worked.

Upvotes: 1

Related Questions