1

I have created a custom theme,

   Thomson/
    └── 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.

Reference:

Error:

Frontend:

enter image description here

Suggest me, How to fix this..

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

2 Answers 2

3

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 -->
   <media>
        <preview_image>media/preview.jpg</preview_image>
   </media>
</theme

Solution 2 -

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

Thomson/
    └── book
        ├── composer.json
        ├── media
        │   └── image.png
        ├── registration.php
        └── theme.xml
        |-- web
             |--js
                 |--responsive.js
                 |--theme.js
3
  • But luma theme does not have that js. How is that working? Commented May 27, 2018 at 3:05
  • I have exactly same issue, luma theme does not have that js. Commented May 3, 2019 at 2:52
  • Hey I tried the second solution but not working. Commented Aug 26, 2019 at 13:45
0

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 and acknowledge you have read our privacy policy.

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