Jump to content

Method for build / deploy project with gulp


frenetikm
 Share

Recommended Posts

Hi,

 

I discovered gulp some weeks ago, I currently use it for concatenate my js files, and minify / uglify the results in a game.min.js.

 

But when come the time to push my files on an ftp server, I think that gulp could be used in a more powerful way, for example copying all files needed in a "build" directory, that could be directly pushed on the server.

 

If someones use a tasks manager tool like gulp, could you explain the way you use it, and the best practices ?

 

 

Link to comment
Share on other sites

I use Gulp for local development. Using browser-sync i run my gulp script and watch my html and js files. Upon a change browser-sync will refresh my browser page. Browsersync offers a build in webserver but can also be used with another server such as XAMPP or MAMP.

 

I'm not sure why you would want to push your files to a server using gulp because the way i see it gulp is purely a tool used during development. Uploading your files to a server usually means that the project is being released to be used by the public. Having to upload your files on every change during development also decreases the time you use for actual development.

 

I used to watch files on a mounted disk which took a few seconds for gulp to process the files. When gulp is watching files stored locally this merely takes a few 100 milliseconds.

 

I've used the phaser-es6-boilerplate repository on Github and changed Gulpfile and directory structure it used into the following:

There's also a package.json to install the dependencies needed for this Gulpfile.

 

https://gist.github.com/CupCoffee/8e2f5c3ce1349fd1b0a8

 

Gulp watches all js files and reloades browser-sync on save. The code is a bit messy but provides a less complicated example than phaser-es6-boilerplate imo.

Link to comment
Share on other sites

Thanks, I didn't mean to use gulp to push the files, but use gulp to create a folder with all files needed to be pushed.

 

the boilerplate you put in example give me an answer :

- create "src" folder for js sources

- create "static" (I have often seen "public") for html + css

- gulp make all the operations : create build directory, copy static directory into it and concatenate / uglify js to build directory

 

I will work on my personal Phaser project boilerplate to have a similar structure.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...