0

I'm still a Grunt newbie and I'm having difficulties "watching" for php files.

What happens is that the livereload works perfectly fine for any php file but any task I want to launch in regard to changes on php files simply doesn't happen... In this case i wanted to use ftp-deploy to push the ftp files to my server each time they change (this way I get to keep my workflow by linking to the php files directly on my server and using a simple MAMP installation).

My watch code goes something like this:

watch: {
    concat: {
      files: '<%= project.src %>/js/{,*/}*.js',
      tasks: ['concat:dev', 'jshint']
    },

    sass: {
      files: '<%= project.src %>/scss/{,*/}*.{scss,sass}',
      tasks: ['sass:dev', 'cssmin:dev', 'autoprefixer:dev']
    },

    banana: {
      files: '<%= project.src %>/php/*.php',
      tasks: ['ftp-deploy']
    },


    livereload: {
      options: {
        livereload: LIVERELOAD_PORT
      },
      files: [
        '<%= project.app %>/{,*/}*.html',
        '<%= project.assets %>/css/*.css',
        '<%= project.assets %>/js/{,*/}*.js',
        '<%= project.src %>/php/{,*/}*.php',
        '<%= project.assets %>/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
      ]
    }
  }

So everything works perfectly even the livereload for the php files, to the huge exception that the ftp-deploy task doesn't happen.

If I add that ftp-deploy task onto the sass target or the concat target it works perfectly but on the banana target (yeah... I started to get frustrated) it simply doesn't work at all!

I'm breaking my head with this...

Can someone help me out?

Thanks in advance.

LIMsomnium
  • 127
  • 1
  • 3
  • 12

1 Answers1

0

Hmmm... looking at your watch tasks, it seems like you want .php files in the /php/ directory or any subdirectory. In that case, maybe you really want this:

banana: {
  files: '<%= project.src %>/php/**/*.php', // the ** says this or any sub-directory
  tasks: ['ftp-deploy']
},

My guess is that's the target of your livereload task as well:
'<%= project.src %>/php/{,*/}*.php'
which maybe could be rewritten as (not 100% sure):
'<%= project.src %>/php/**/*.php'

Jordan Kasper
  • 13,153
  • 3
  • 36
  • 55