Skip to content

Instantly share code, notes, and snippets.

@robrich
Created June 19, 2014 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robrich/7bc87eb851b49780b8ac to your computer and use it in GitHub Desktop.
Save robrich/7bc87eb851b49780b8ac to your computer and use it in GitHub Desktop.
sample gulpfile.js created at @phxjs
//jshint node:true
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var uglify = require('gulp-uglify');
var gulpIf = require('gulp-if');
var express = require('express');
var path = require('path');
gulp.task('scripts', function () {
return gulp.src('./public/js/**/*.js')
.pipe(uglify())
.pipe(gulp.dest('./public/jsmin'));
});
gulp.task('css', function (cb) {
gulp.src(['./public/css/**/*.less', './public/css/**/*.css'])
.pipe(gulpIf('*.less', less()))
.pipe(gulp.dest('./public/cssmin'))
.on('end', cb)
.on('finish', cb);
});
gulp.task('startup', ['css', 'scripts'], function (cb) {
var app = express();
app.use(express.static(path.join(__dirname,'public')));
app.listen(3000, function (err) {
console.log('the server is running on port '+3000);
cb(err);
});
});
gulp.task('default', ['scripts', 'css', 'startup']);
// run this from the command line: `gulp`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment