Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome's "Auto-Reload Generated CSS" not reloading page when SASS recompiles CSS

I'm trying to get Chrome's DevTools to auto reload a page when I save a watched SCSS file which will compile and make changes to the CSS file.

I have the Auto-reload generated CSS option checked, but sadly, it isn't working as expected. enter image description here

Whenever I make changes to the SCSS file and save it, the page doesn't reload. I have added my working folder to the workspace and also mapped the files (both the SCSS file and the generated CSS) to their respective versions on my local system drive. This, however, doesn't help.

The SASS source maps seems to be working fine as the scss files are reflected in the DevTools inspector:

enter image description here

I'm using Chrome version 31:

enter image description here

Have I missed out anything that I don't know of? What else do I have to do to get this to work?

like image 942
Carven Avatar asked Jan 02 '14 16:01

Carven


2 Answers

I used drupal in this case and drupal generate css link like 'style.css?abc'. Problem in this suffix '?abc'. You need to start file mapping from LOCAL (press right-click on local) 'style.css' to WEB 'style.css?abc' (shown in list). Not from WEB to LOCAL. If result is correct WEB-links disappears from list in 'resourses' tab.

like image 125
szdv Avatar answered Nov 07 '22 00:11

szdv


here is a good solution, to avoid this mapping issue of .css?201203241721 / .js?201203241721-files as szdv mentioned with drupal. I have had it with typo3 and this solved it:

    /* remove in production *************************************************/
    //filter typo3 temp file src/href with ?date ending for chrome workspaces
    $('script, link').each(function(){
        rpString = /\?[0-9]*/;
        if(this.src){
            this.src = this.src.replace(rpString,'');
        }
        if(this.href){
            this.href = this.href.replace(rpString,'');
        }
    });
    /* ******************** *************************************************/
like image 1
systrue Avatar answered Nov 07 '22 01:11

systrue