简体   繁体   中英

Gruntjs - Watch/Browsersync doesn't reload php

So I am using grunt to help me develop sites. For last two weeks I am having issues with Browsersync/Watch.

When I am making changes to a php files, browsersync doesn't detect any changes. Even, when I am reloading the site manually, source code is not updated. Most funny part is, this code gets updated after "some time" or when I am restarting grunt.

watch: {
    php: {
        files: ['*.php', '**/*.php'],
    }
},
// Run Browser Sync
browserSync: {
    default_options: {
        bsFiles: {
            src: [
                "**/*.php",
                "*.php",
            ]
        },
        options: {
            watchTask: true,
            proxy: 'g.test',
        }
    }
}

Does anyone had familiar issue?

Do you have a

body
tag in your PHP files? Also, when running grunt, do you have a script (like one below) injected under body?

 <script id="__bs_script__"> //<![CDATA[document.write("<script async src='/browser-sync/browser-sync-client.js?v=2.26.7'><\\/script>".replace("HOST", location.hostname)); //]]> </script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM