How to modify CSS files in Magento 2

- Fire development, Magento 2

Magento 2 Development

In Magento 2, do not modify CSS files within pub/* or vendor/* directories, because pub is for deployment and vendor is for default structure. Instead:

  • Create a new theme in app/design/frontend/{vendor}/{yourTheme}/, as well as a new theme which inherits from Blank.
  • Edit an appropriate .less file. Don’t get replaced when clearing the cache or upgrading the system.
  • Utilize Grunt for compiling .less into deployment files.
  • Setup sourcemaps to pinpoint your styling within the theme .less files. This step improves your productivity.

Source: stackexchange question, bb8d

More tips from the cookbook