I have created a custom theme,

    └── book
        ├── composer.json
        ├── media
        │   └── image.png
        ├── registration.php
        └── theme.xml

After that I choose my custom theme via admin, my frontend not load correctly.

I tried, static-content deploy, clear cache, and remove <m2>/var/* files

css are calling but theme.js and responsive.js is goes to 404.




enter image description here

Suggest me, How to fix this..

  • Please share your theme files.. For a suggestion,pub/static(exclude .htaccess) and **var/view_preprocessed delete – Amit Bera Sep 19 '17 at 13:51
  • @AmitBera I follow Magento Spider answer, now works fine – Rajkumar .E Sep 20 '17 at 5:50
  • cool,please accept his/her answer – Amit Bera Sep 20 '17 at 5:52

There are two solutions

Solution 1 -

You need to define parent in your theme.xml file, so the that responsive.js and theme.js file will access from the parent theme

theme.xml ( app/design/frontend/Thomson/Book/theme.xml )

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
   <title>Thomson Book</title> 
   <parent>Magento/blank</parent> <!-- the parent theme -->

Solution 2 -

You need to add both the files responsive.js and theme.js in your custom theme.

    └── book
        ├── composer.json
        ├── media
        │   └── image.png
        ├── registration.php
        └── theme.xml
        |-- web
  • But luma theme does not have that js. How is that working? – Krishnan Daiva May 27 '18 at 3:05
  • I have exactly same issue, luma theme does not have that js. – Yusuf Ibrahim May 3 '19 at 2:52
  • Hey I tried the second solution but not working. – Riddhish Bhayani Aug 26 '19 at 13:45

My issue was that it was constantly loading theme.js from the parent theme instead of the child theme even with cache cleaning..

I solved it by manually removing the symlink from pub/static/[...]/theme.js and doing a static deploy + reloading the page.

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.