Last active
August 29, 2015 14:06
-
-
Save cliftoncanady/ce0d39b1449eaa2a104d to your computer and use it in GitHub Desktop.
Gulp Starter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'), | |
| sass = require('gulp-sass'), | |
| autoprefixer = require('gulp-autoprefixer'), | |
| rename = require('gulp-rename'), | |
| cssmin = require('gulp-cssmin'), | |
| jshint = require('gulp-jshint'), | |
| concat = require('gulp-concat'), | |
| uglify = require('gulp-uglify'), | |
| imagemin = require('gulp-imagemin'), | |
| pngcrush = require('imagemin-pngcrush'), | |
| addsrc = require('gulp-add-src'), | |
| watch = require('gulp-watch'), | |
| livereload = require('gulp-livereload'), | |
| rsync = require('gulp-rsync'); | |
| gulp.task('sass', function() { | |
| gulp.src('./scss/app.scss') | |
| .pipe(sass()) | |
| .pipe(autoprefixer("last 2 version", "ie 9")) | |
| .pipe(cssmin()) | |
| .pipe(rename({suffix: '.min'})) | |
| .pipe(gulp.dest('./dist/css')); | |
| }); | |
| gulp.task('img', function () { | |
| return gulp.src('./css/img/*') | |
| .pipe(imagemin({ | |
| progressive: true, | |
| svgoPlugins: [{removeViewBox: false}], | |
| use: [pngcrush()] | |
| })) | |
| .pipe(gulp.dest('./dist/img')); | |
| }); | |
| gulp.task('js', function() { | |
| gulp.src('./js/app.js') | |
| .pipe(jshint()) | |
| .pipe(jshint.reporter('default')) | |
| .pipe(addsrc('./js/*/*.js')) | |
| .pipe(concat('app.min.js')) | |
| .pipe(uglify()) | |
| .pipe(gulp.dest('./dist/js')); | |
| }); | |
| gulp.task('watch', function() { | |
| livereload.listen(); | |
| gulp.watch('./scss/**/*.scss', ['sass']).on('change', livereload.changed); | |
| //gulp.watch('./css/img/**/*', ['img']).on('change', livereload.changed); | |
| gulp.watch('./js/**/*.js', ['js']).on('change', livereload.changed); | |
| gulp.watch('./**/*.php').on('change', livereload.changed); | |
| }); | |
| // gulp.task('deploy', function() { | |
| // gulp.src('build/**') | |
| // .pipe(rsync({ | |
| // root: 'build', | |
| // hostname: 'example.com', | |
| // destination: '/path/to/site' | |
| // }); | |
| // }); | |
| gulp.task('build', ['sass', 'img', 'js']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "GulpJS-Starter", | |
| "description": "This is a gulp workflow starter package.json", | |
| "version": "1.0.0", | |
| "homepage": "cliftoncanady.co", | |
| "devDependencies": { | |
| "gulp": "~3.8.8", | |
| "gulp-rename": "~1.2.0", | |
| "gulp-sass": "~1.0.0", | |
| "gulp-autoprefixer": "~1.0.1", | |
| "gulp-cssmin": "~0.1.6", | |
| "gulp-jshint": "~1.8.4", | |
| "gulp-concat": "~2.4.1", | |
| "gulp-uglify": "~1.0.1", | |
| "gulp-add-src": "~0.1.1", | |
| "gulp-watch": "~1.0.7", | |
| "gulp-livereload": "~2.1.1", | |
| "gulp-imagemin": "~1.0.1", | |
| "imagemin-pngcrush": "~1.0.0", | |
| "gulp-htmlmin": "~0.2.0", | |
| "gulp-rsync": "0.0.4" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment