I have added code in the default XML block(FOR CUSTOM CSS FILE) in my custom theme and after this made content-deploy also but it was still not reflecting in my source code,

<?xml version="1.0"?>
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
        <css src="css/theme.css"/>
        <css src="css/bootstrap.min.css"/>
  • IF U change the css ,You have to run the below commands php bin/magento setup:static-content:deploy – Learing_Coder Apr 4 '18 at 10:28
  • already tried but still not showing... – Shubham Jaiswal Apr 4 '18 at 10:38
  • can you share the default layout file for adding the css..? – govindaraj Apr 4 '18 at 11:03
  • make sure that your css files are located in <current theme root>/web/css path – Emipro Technologies Pvt. Ltd. Apr 4 '18 at 11:16

Follow below steps to call custom files in your custom theme:

Step1: Add theme.css and bootstrap.min.css in "current theme root directory/web/css"

Custom files are stored in root path because you have given path like:

 <css src="css/theme.css"/>
 <css src="css/bootstrap.min.css"/>

Step2:after complete first step fire bolow 2 commands:

php bin/magento setup:upgrade 
php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean

Refresh page and check your changes.
Hope it will be helpfull.

  • I have place exactly in the same format but still facing the same issue. – Shubham Jaiswal Apr 4 '18 at 11:45
  • Sorry to say but still facing same problem... – Shubham Jaiswal Apr 4 '18 at 11:48
  • It might be some little mistake to configure theme. – Emipro Technologies Pvt. Ltd. Apr 4 '18 at 11:50
  • on deplying the same css files are generated in the pub/static folder but don't know why it doesn't reflect in the souce code... – Shubham Jaiswal Apr 4 '18 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.