Last active
October 20, 2015 10:41
-
-
Save kikill95/2c16af8052d648ad44dc to your computer and use it in GitHub Desktop.
Gulp. Set
This file contains 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'), | |
concat = require('gulp-concat'), | |
ngAnnotate = require('gulp-ng-annotate'), | |
uglify = require('gulp-uglify'), | |
autoprefixer = require('gulp-autoprefixer'), | |
sass = require('gulp-sass'), | |
minifyCss = require('gulp-minify-css'), | |
del = require('del'), | |
imagemin = require('gulp-imagemin'), | |
sourcemaps = require('gulp-sourcemaps'), | |
babel = require('gulp-babel'), | |
browserSync = require('browser-sync').create(); | |
gulp.task('default', ['clean'], function() { | |
gulp.start('sass', 'images', 'scripts'); | |
}); | |
gulp.task('clean', function () { | |
del(['css', 'js', 'images']); | |
}); | |
gulp.task('sass', function () { | |
return gulp.src('web-src/scss/*.scss') | |
.pipe(sourcemaps.init('')) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(autoprefixer()) | |
.pipe(minifyCss({ | |
keepSpecialComments: 0 | |
})) | |
.pipe(sourcemaps.write('')) | |
.pipe(gulp.dest('css')) | |
.pipe(browserSync.stream()); | |
}); | |
gulp.task('images', function () { | |
return gulp.src(['web-src/images/*']) | |
.pipe(imagemin({ | |
progressive: true, | |
interlaced: true | |
})) | |
.pipe(gulp.dest('images/')) | |
.pipe(browserSync.stream()); | |
}); | |
gulp.task('scripts', function() { | |
return gulp.src(['modules/**/*.js', 'modules/**/js/*.js']) | |
.pipe(sourcemaps.init()) | |
.pipe(babel()) | |
.pipe(ngAnnotate()) | |
.pipe(concat('main.js')) | |
.pipe(uglify()) | |
.pipe(sourcemaps.write(".")) | |
.pipe(gulp.dest('js/')) | |
.pipe(browserSync.stream()); | |
}); | |
gulp.task('serve', function () { | |
browserSync.init({ | |
scriptPath: function (path, port, options) { | |
return "/browser-sync/browser-sync-client.js"; | |
}, | |
socket: { | |
domain: 'localhost:3000' | |
}, | |
server: { | |
baseDir: "./" | |
}, | |
notify: false | |
}); | |
gulp.watch('web-src/scss/*.scss', ['sass']); | |
gulp.watch('web-src/images/*', ['images']); | |
gulp.watch(['modules/**/*.js', 'modules/**/js/*.js'], ['scripts']); | |
gulp.watch(['index.html', 'modules/**/**/*.html']).on('change', browserSync.reload); | |
}); |
This file contains 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": "<name>", | |
"version": "1.0.0", | |
"description": "<description>", | |
"main": "gulpfile.js", | |
"dependencies": { | |
"bower": "^1.3.12", | |
"browser-sync": "^2.9.11", | |
"del": "^2.0.2", | |
"gulp": "^3.9.0", | |
"gulp-autoprefixer": "^3.0.2", | |
"gulp-babel": "^5.2.1", | |
"gulp-concat": "^2.6.0", | |
"gulp-imagemin": "^2.3.0", | |
"gulp-minify-css": "^1.2.1", | |
"gulp-ng-annotate": "^1.1.0", | |
"gulp-sass": "^2.0.4", | |
"gulp-sourcemaps": "^1.5.2", | |
"gulp-uglify": "^1.4.1" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"prestart": "npm update", | |
"postinstall": "bower update" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "<something>.git" | |
}, | |
"author": "<someone>", | |
"license": "UNLICENSED" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment