Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a Script on Build (e.g. Gulp or Grunt)

I have a project.json script for 'prepare' that runs a gulpfile to push my bower stuff into the wwwroot. Works great, except during dev I have to manually run it after I update the bower.json package. Any way to automate this during dev? I'd normally use a post-build script but they are no where to be seen. My project.json scripts are looks like this:

  "scripts": {
    "prepare": [ "gulp bower" ]
  }

What i'd love is:

  "scripts": {
    "post-build": [ "gulp bower" ]
  }
like image 999
Shawn Wildermuth Avatar asked May 28 '15 21:05

Shawn Wildermuth


2 Answers

You can use the Task Runner Explorer to automate this. (Use the Quick Launch in the upper right, Ctrl+Alt+\, or View->Other Windows->Task Runner Explorer.)

Find the task you want to add (bower or prepare, depending on the route you want to go), right click, and use the context menu to add the bindings.

My gruntfile.js, for example, got the following line added to the top:

/// <binding BeforeBuild='beforeBuild' AfterBuild='afterBuildMinimal' ProjectOpened='watch' />

I'm not certain if the gulpfile.js uses the exact same conventions, but the Task Runner Explorer is the way to go, either way!

like image 151
Matt DeKrey Avatar answered Oct 16 '22 21:10

Matt DeKrey


there's postrestore and postbuild you can use on project.json.

I use it like this :

"postrestore": [ "npm install", "bower install" ]
"postbuild": [ "brunch build" ]

in your example, I think you want

"postbuild": [ "gulp bower" ]
like image 1
Bart Calixto Avatar answered Oct 16 '22 19:10

Bart Calixto