Skip to content

Instantly share code, notes, and snippets.

@tedshd
Created July 1, 2016 03:44
Show Gist options
  • Select an option

  • Save tedshd/7a13069a3f5a2cae36834a680172727b to your computer and use it in GitHub Desktop.

Select an option

Save tedshd/7a13069a3f5a2cae36834a680172727b to your computer and use it in GitHub Desktop.
gulp setting package
/**
*
* @authors Ted Shiu (ted@sitetag.us)
* @date 2016-07-01 11:40:47
*/
var gulp = require('gulp'),
watch = require('gulp-watch'),
cssmin = require('gulp-cssmin'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
var css ='',
device = '',
js = '';
gulp.task('default', function (cb) {
var options = {};
watch('./**/*.css', options, function (e) {
// console.log('e:'+JSON.stringify(e));
console.log(new Date() + ' -- ' + e.history[0].replace(e.base, ''));
// console.log('\n');
gulp.src('./dev/css/*.css')
.pipe(concat('site.css' , {newLine: '\n'}))
.pipe(cssmin())
.pipe(gulp.dest('./build/'));
});
watch('./**/*.js', options, function (e) {
// console.log('e:'+JSON.stringify(e));
console.log(new Date() + ' -- ' + e.history[0].replace(e.base, ''));
// console.log('\n');
gulp.src('./dev/js/*.js')
.pipe(concat('site.js' , {newLine: '\n'}))
.pipe(uglify())
.pipe(gulp.dest('./build/js/'));
});
});
{
"name": "",
"version": "",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-cssmin": "^0.1.7",
"gulp-uglify": "^1.5.3",
"gulp-watch": "^4.3.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment