Disable caching magento while editing CSS and HTML files

Disable caching magento while editing CSS and HTML files

August 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Disable caching magento while editing CSS and HTML files

Dealing with Caching Issues While Developing Magento CSS and JS

Disabling caching when developing your Magento site is crucial for ensuring that your changes take effect immediately. Seeing updates to JavaScript (JS) and Cascading Style Sheets (CSS) without having to dump the cache in two places can save you a lot of time and frustration.

Understanding Magento Caching Mechanisms

Magento has several types of caches, each serving a unique purpose. The CSS/JS merge files are stored under pub/static directory and cached separately from other static content. This is why clearing the browser cache alone sometimes doesn’t show your updates.

Configuring Your Development Environment Properly

To ensure smooth development without caching issues:

  1. Set ‘Developer Mode’: Go to Stores > Configuration > Advanced > Developer. Set “Enabled” under both “Debug” and “Template Path Hints” sections.

  2. Disable Compilation: Under the same configuration, set “Compilation Status” to “Disabled”.

  3. Clear All Caches: Navigate to System > Cache Management. Select all checkboxes and click on “Flush Magento Cache”. This will clear all types of caches including CSS/JS ones.

Why You’re Still Seeing Issues

Even after clearing the cache in this manner, you might still face issues due to the following reasons:

  • Browser Cache: Modern browsers aggressively cache static resources. Clearing your browser’s cache is essential. Right-click > Inspect > Network conditions > Disable cache.

  • Magento Full Page Cache: If enabled (which it shouldn’t be during development), it can serve cached versions of pages despite other caches being cleared.

Advanced Troubleshooting Steps

If you’re still facing issues, consider the following:

  1. Delete pub/static Content: Navigate to pub/static directory in your Magento installation and delete all contents within this folder. This will force Magento to regenerate these files every time.

  2. Check .htaccess Settings: Ensure that the pub/static folder has proper write permissions (chmod 775) and .htaccess file is properly configured for static content serving.

  3. Recompile Your Site: Sometimes, a full re-compilation can help resolve issues. Use Magento’s built-in commands: php bin/magento set:install:mode -s=default; php bin/magento cache:clean; php bin/magento indexer:reindex

Dealing with Production Deployments

Remember that these settings are not suitable for a production environment. There, you should enable all caches and consider using a Content Delivery Network (CDN) for serving static assets efficiently.

For detailed instructions on Magento deployment best practices, I highly recommend checking out Laravel Company’s guide on deploying Laravel applications. This resource provides a comprehensive overview of the process and helps ensure your site remains performant while allowing for secure updates.

Conclusion

Disabling caching during Magento development is essential but requires understanding the different cache types. By properly configuring your environment, clearing all caches, and ensuring your browser doesn’t hold onto cached resources, you should see your CSS/JS changes immediately without needing to manually flush the cache within Magento multiple times.

If you’re still facing issues after following these steps, it might be time to dig deeper into specific file permissions or server configurations. Always remember that while development settings provide speed and ease of testing, they are not suitable for live production environments where security and performance are paramount.

Cache Themes Configuration Deployment

Our network