frenetikm Posted November 20, 2015 Share Posted November 20, 2015 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 ? shohan4556 1 Link to comment Share on other sites More sharing options...
cupcoffee Posted November 21, 2015 Share Posted November 21, 2015 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. frenetikm 1 Link to comment Share on other sites More sharing options...
frenetikm Posted November 23, 2015 Author Share Posted November 23, 2015 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 More sharing options...
Recommended Posts