Add a delay in "Ground" for "Less files"

I am using Grunt to compile Fewer files on the server, the problem is I upload fewer files through the server using an FTP client (Filezilla), the Grunt -watch task starts compiling fewer files from the very first byte it receives before allow the download to complete completely, which will cause the CSS file to be empty.

I need to be able to fully upload the file to the server and Grunt Watch does its job, so I wondered if there was a command to give Grunt a wait delay, for example after 2 seconds, then start the task.

+3


source to share


1 answer


You can get a similar effect by letting the trigger fire instantly and then run the task wait

(from the grunt-wait

plugin) before your task less

, something like the lines:



less: {
    dist: {
        files: [{
            expand: true,
            cwd: 'yourdir',
            src: '*.less',
            dest: 'destdir',
            ext: '.css'
        }]
    }
},

wait: {
    ftp: {
        options: {
            delay: 2000
        }
    }
},

watch: {
    less: {
        files: ['yourdir/*.less'],
        tasks: ['wait:ftp', 'less:dist']
    }
},

      

+1


source







All Articles