I recently started working in Magento 2, after reading docs and tutorial I set up my first magento site and is running successfully on my localhost.
I am now setting a new Magento 2 project, I used the same way I setup the previous project, but now, my custom.css file not loading and I can't even find that in the page source if it's loaded. I've checked many times the path etc., and everything seems OK.
I've added the custom.css file in the following path:
app/design/frontend/<vendor>/<theme>/Magento_Theme/layout/default_head_blocks.xml
I have noticed that running the command
php bin/magento setup:static-content:deploy
not generating the custom.css file in the static folder.
Please help me sort out where I am doing mistake.
Thanks.
Best Answer
Here is 2 ways to add you custom styles in your theme.
1. Backend
Navigate to Content > Design > Configuration > Select Theme > HTML Head section > Scripts and Style Sheets field
2. Less processor.
here is your theme directory
create new file
add new styles here
deploy changes
you need to deploy static content to see any changes. For development purpose Magento 2 provides grunt tool.
you will find luma example here
More information here http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/css-topics/css_debug.html