Chrome's “Auto-Reload Generated CSS” not reloa

2020-05-23 11:46发布

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?

2条回答
狗以群分
2楼-- · 2020-05-23 12:35

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.

查看更多
倾城 Initia
3楼-- · 2020-05-23 12:49

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,'');
        }
    });
    /* ******************** *************************************************/
查看更多
登录 后发表回答