srs / gradle-gulp-plugin

Gradle plugin for running Gulp tasks
70 stars 9 forks source link

Trying to understand how to run default gulp task from gradle #16

Closed justinbleach closed 8 years ago

justinbleach commented 8 years ago

I can't get my 'default' task in my gulpfile.js to run from gradle. I'm new to gradle and the documentation for this plugin only shows the command line usage of gradle gulp_build. I have to specify my gulpfile location however because it is one directory down from my build.gradle.

Can anyone recommend how to run my default gulp task given what I already have below?

// attempt 1 to get default gulp task to work
build.dependsOn.gulp_default

gulp {
    workDir = file("/WebContent")
    // to prove to myself this is actually running
    println "HI!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    //attempt 2 to get default gulp task to run
    gulp_default
}

task buildWar(type:War) {

    from("WebContent") {
        exclude "app/"
        into "/"
    }

    // if gulp runs I should have javascript here
    from("target/java-script-dist") {
        into "/"
    }
}
buildWar.dependsOn gulp
justinbleach commented 8 years ago

Never mind. Got it after looking at the source. Just need to figure out how to get the gulpfile.js to run before the war. Doing buildWar.dependsOn gulp_default doesn't work where as build.dependsOn gulp_default works but after the war is built.

build.dependsOn gulp_default

node {
    nodeModulesDir = file("WebContent")
}

gulp {
    workDir = file("WebContent")
}

task buildWar(type:War) {

    from("WebContent") {
        exclude "app/"
        into "/"
    }

    from("target/java-script-dist") {
        into "/"
    }
}
ahsanulalig commented 6 years ago

Hi I am trying to call gulp build task from gradle but not successful. //Code snippet below buildscript { repositories { jcenter() maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "com.moowork.gradle:gradle-node-plugin:1.2.0" } }

apply plugin: "com.moowork.gulp"

gulp { workDir = file("frontend") }

task runGulp(){ gulp_build } //Not calling gulp task build //could you help on this //Gradle runs successfully but gulp task not executing

Thanks Ahsanul