Coder Social home page Coder Social logo

Comments (6)

sindresorhus avatar sindresorhus commented on August 19, 2024

How do you inject the Livereload snippet?

https://github.com/gruntjs/grunt-contrib-watch#enabling-live-reload-in-your-html

It has to match whatever you change your hostname too.

from grunt-php.

brodkin avatar brodkin commented on August 19, 2024

@sindresorhus I'm using the browser extension, but I can tell that it's a server issue not a client issue.

If I run grunt:watch directly I can navigate to http://localhost:35729/ and it works just fine. If I run my task that starts grunt-php first then navigating to that same address fails.

from grunt-php.

sindresorhus avatar sindresorhus commented on August 19, 2024

Can you share the relevant part of your Gruntfile?

from grunt-php.

brodkin avatar brodkin commented on August 19, 2024

Sure!

my dev task

grunt.registerTask('dev', [
'php:watch',
'watch'
]);

grunt-php

php: {
  watch: {
    options: {
      hostname: '0.0.0.0',
      port: 8000,
      base: 'public',
      router: path.resolve('server.php')
    }
  }
},

grunt-contrib-watch has nothing fancy--just livereload: true is set.

I can take this exact configuration and set the hostname to localhost and it will suddenly work.

from grunt-php.

brodkin avatar brodkin commented on August 19, 2024

Ykw? I thought it was just livereload not working. I hadn't realized that the watch task never gets fired at all. The behavior is almost as if keepalive had been set to true.

from grunt-php.

brodkin avatar brodkin commented on August 19, 2024

I think the issue is on line 14 of php.js. When checking for a server start the hostname is passed directly to http.request and while 0.0.0.0 is an acceptable value for the PHP built-in server, Node cannot resolve it. Interpreting an ip of 0.0.0.0 as localhost would probably fix this issue. I've never written or contributed to a grunt task before, but I can try to test this and write a fix.

from grunt-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.