0

I'm having issues with getting my custom Magento 2 theme to compile correctly.

I installed it on a remote server and configured it. All is working on that end. I can flush the cache and deploy the static - it seems fine.

However when I download the files for local development the CSS and JS is not compiling correctly. The only thing I have changed is the url in the core_config_data table to http://localhost - When I switch the database to a fresh install of Magento and do a static deploy and remove all var/cache etc files it loads back fine.

However, when I change the env.php file back to the downloaded DB with the edited URL and I flush the cache it goes back to not loading any CSS files.

Have followed the guides here.

Magento 2 CSS and JavaScript not loading from correct folder

Magento 2: Not loading CSS and JS after successful installation in windows

0

After pulling the project in your localhost, the first thing you have to do is switch to developer mode

php bin/magento deploy:mode:set developer

While developing, in order to view the changes of the static files, you should run this command to symlink them with the pub/static folder:

php bin/magento dev:source-theme:deploy

After any change, clear the cache and refresh the browser.

If you get it to work with the given commands, read more on how to automate the process with tools like grunt or gulp:

https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/css-topics/css_debug.html

  • No, still not working. There's no JS and still no CSS being loaded. I have removed the symlinks in the di.xml file to just copy. It works fine on a fresh install of DB. I'm thinking there's an issue in the DB somewhere. Any ideas? – saulable Jan 28 at 16:58
  • @saulable please provide me all the steps that you're following after pulling the installation in your localhost. – arjus Jan 28 at 17:11
  • I'm re-pulling now with the working remote copy. Going to double check for you. Something may have corrupted whilst trying all these commands. – saulable Jan 28 at 17:24
  • So I pulled down the site again and it seems to be fine. Something must have got corrupted. Have put it in to developer mode, which is great. Also, thanks for the other command. Now need to go set up some gulp and start working. Much appreciated :) – saulable Jan 28 at 18:08

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.