How to deploy gulp on production server

When building a website (for the sake of clarity an HTML/JS only website) I use gulp to compile and concat some files which are then placed in a build/ folder.

The folder structure looks something like this:

  • Why is bundler not installing gems stored in get repo properly?
  • How to include ssh private rsa key when accessing git repo via ssh (gitosis)?
  • Github: I have a fork of a fork.. can I make it a fork of the original repo instead?
  • Git not showing deleted lines in log
  • Move git repository to a subdirectory in the same path while preserving all of its history
  • Find a common commit in two completely different git trees
  • ├── assets
    │   ├── images
    │   ├── javascripts
    │   │   └── app.js
    │   └── stylesheets
    │       └── style.scss
    ├── bower.json
    ├── build
    │   ├── bower_components
    │   ├── images
    │   ├── index.html
    │   ├── scripts.min.js
    │   └── styles.min.css
    ├── gulpfile.js
    ├── index.html
    ├── node_modules
    │   ├── gulp-module-1
    │   └── gulp-module-2
    ├── package.json
    └── README
    

    If I include all these files in a git repo, all of my changes will be committed twice. That is: a change in assets/stylesheets/style.scss will also lead to a change in build/styles.min.css. However, if I decide to exclude the build/ folder from the repository, you will need certain development tools on the production server (i.e. gulp, npm, etc.) This can sometimes be difficult when there’s limited privileges on the production server. Obviously excluding the assets/ folder is not an option as you will lose the source for your compiled files.

    Therefore my question is: what is considered best practice to deploy this on a production server? Do you include the build/ folder in the repo, do you compile the build/ folder on the production server or is there a third solution?

  • GIT: more than one developer working on the same feature
  • Losing the error output from a command in the (set) element of batch file FOR statement
  • How to push from one bare git repo to another?
  • How can I delete a remote Git repository from the command line (Git Bash)?
  • How to retrieve the git branch name that was built by Jenkins when using inverse branch selection strategy?
  • How can/should Zend Framework 2 be included to a Git versioned project?
  • One Solution collect form web for “How to deploy gulp on production server”

    Although not everybody might agree on what the best solution is for this problem, I think there is a third solution you have missed and that I would generally prefer. You can build all the files on your development machine, and then deploy the files that were built to your production server. That would usually only be a copy action.

    This way you will not need to have any development tools on your server and you will not have build output in your version control system.

    Git Baby is a git and github fan, let's start git clone.