Guard/LiveReload/Sass/Compass CSS Caching Issue

Here is a quick primer on my setup.

Running an aurora sub theme that utilizes guard, guard compass, guard livereload.

Basically what is happening is I make a change in a sass file, the files compile and the style change is shown right away on the browser. Great.

The problem arises when I click a link to go to another page, the CSS that is on the newly visited page is from the previous state. So my test cases are.. change the background color from blue to red. Background changes to red on the screen. Click a link to another node, background remains blue. Simple browser refresh, background turns to red.

I’ve been trying to find some info on this specifically, but having a heck of a time.

Things I’ve tried so far

  1. Turn off sass caching in my config.rb file, so no .sass-cache generation {:cache => false}.

  2. Reference my stylesheet via a hard coded entry in the html.tpl.php template instead of via the info file.

  3. Tried a basic 2 .html page test case, nothing to do with drupal, and I get the results I wanted (no css cached).

  4. I’ve even looked at Chrome settings before really deciding I felt this is a Drupal thing.

  5. I made a color change, watched the result in my browser, went into the sites/default/files/css/ directory and deleted all the css files, went back to my browser and clicked on a link to another node, and the same result happened, previous CSS rendering.

  6. Did the same thing above except instead of deleting CSS files from the folder, I just ran a drush cc css-js in terminal, then went and visited the second node link, and still old CSS renders.

  7. I have not implemented this, but I know I can run drush commands via guard shell and was wondering if I can do the above in 6, just automate it.

  8. Messed around with config.rb settings such as debug, line_comments, environment or production variables, etc.

I am running out of ideas on how to get this to work a bit better.

Any suggestions?

Sponsored by SupremePR
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Guard/LiveReload/Sass/Compass CSS Caching Issue

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.