I want to modify css file pub/static/frontend/Magento/luma/en_US/css/styles-l.css
.
Initially this file is not present in pub/static folder and it's present in
vendor/magento/theme-frontend-blank/web/css/styles-l.less (it's styles-l.less)
When I deply static contents using php bin/magento setup:static-content:deploy
, 2 files are created in pub/static related to it.
1. pub/static/frontend/Magento/luma/en_US/css/styles-l.less
2. pub/static/frontend/Magento/luma/en_US/css/styles-l.css
I'm a backed developer and while developing modules I tend to delete whatever is present in pub/static (except .htaccess).
So to me it doesn't seem to be the best option to directly modify pub/static/frontend/Magento/luma/en_US/css/styles-l.css
.
In that case what's the best practice to modify above css file?
1. Shall I modify pub/static/frontend/Magento/luma/en_US/css/styles-l.less
or
2. My understanding is wrong that I can delete everything from pub/static
(during development) and I should modify pub/static/frontend/Magento/luma/en_US/css/styles-l.css
and never delete it.
Best Answer
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:
Some useful references: