I am trying to include custom css and js in custom theme and should come on all pages.
I have tried this from the Magento DevDocs, but I can't make it right and it's not showing. Please help me.
I am trying to include custom css and js in custom theme and should come on all pages.
I have tried this from the Magento DevDocs, but I can't make it right and it's not showing. Please help me.
For keep css and js in all pages you have to customize default_head_blocks.xml file. set file,
magento2/app/design/frontend/{Vendor}/{themename}/Magento_Theme/layout/default_head_blocks.xml file
Put inside <head> tag,
<css src="css/styles.css"/>
<script src="js/custom.js"/>
Add your css file inside,
app/design/frontend/{Vendor}/{theme}/web/css/styles.css
Add your custom js
app/design/frontend/{Vendor}/{theme}/web/js/custom.js
Remove cache folder and try.
Its now working in all pages of site.
When I updated my theme, my css files got deleted from app/design/bluesky/frontend/theme-name/web/css/custom.css and also the path from the default_head_block_xml.
php bin/magento setup:static-content:deploydid you deploy content?