2

I have created a basic plugin in magento 2 and also included .css file in correct place as I have seen in many tutorials but when I open frontend page of magento 2(luma page) and do page inspect and in the console after open the issue in tab , it shows :- Unable to resolve the source file for 'frontend/Magento/luma/en_US/Excellence_Hello/css/style.css'

#0 C:\xampp\htdocs\magento\vendor\magento\framework\App\StaticResource.php(97): Magento\Framework\View\Asset\File->getSourceFile()
#1 C:\xampp\htdocs\magento\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\StaticResource->launch()
#2 C:\xampp\htdocs\magento\pub\static.php(13): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\StaticResource))
#3 {main}

what to do to ??? I am also sharing my extension on's link

3

Wrong directory path in your layout file. You keep css and js both in view/frontend/web but in your layout file you mentioned view/frontend/web/css and view/frontend/web/js so it will throw above error

in your layout file change source path like below

<css src="Excellence_Hello::style.css"/>
<script src="Excellence_Hello::style.js"/>

opinion: This is not a good practice to add js. refer this link to add js

| improve this answer | |

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.