Created
January 29, 2016 02:40
-
-
Save merthmagic/509cca89389d5525d2c2 to your computer and use it in GitHub Desktop.
gulpfile template
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'); | |
| var concat = require('gulp-concat'); | |
| var uglify = require('gulp-uglify'); | |
| var jshint = require('gulp-jshint'); | |
| var notify = require('gulp-notify'); | |
| var rename = require('gulp-rename'); | |
| var sass = require('gulp-ruby-sass'); | |
| var autoprefixer = require('gulp-autoprefixer'); | |
| var minifycss = require('gulp-minify-css'); | |
| var path = { | |
| scripts: "src/js/**/*.js", | |
| sass: "src/styles/sass/**/*.scss", | |
| html: 'src/html/**/*.html', | |
| images:'src/images/**/*', | |
| dest:{ | |
| jslib:'build/static/js/lib', | |
| css:'build/static/css', | |
| fonts:'build/static/fonts', | |
| html:'build/html', | |
| images:'build/static/images' | |
| } | |
| }; | |
| gulp.task('default', ['js', 'sass', 'copy'], function () { | |
| }); | |
| gulp.task('copy', function () { | |
| gulp.src('bower_components/angular/angular.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/angular-route/angular-route.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/angular-ui-router/release/angular-ui-router.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/angular-ui-router.stateHelper/statehelper.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/bootstrap/dist/css/bootstrap.min.css') | |
| .pipe(gulp.dest(path.dest.css)); | |
| gulp.src('bower_components/bootstrap/dist/js/bootstrap.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/jquery/dist/jquery.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/bootstrap/dist/fonts/**/*') | |
| .pipe(gulp.dest(path.dest.fonts)); | |
| gulp.src('bower_components/html5shiv/dist/html5shiv.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('bower_components/respond/dest/respond.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src(path.html).pipe(gulp.dest(path.dest.html)); | |
| gulp.src(path.images).pipe(gulp.dest(path.dest.images)); | |
| gulp.src('src/styles/css/bootstrap-override.css') | |
| .pipe(gulp.dest(path.dest.css)); | |
| gulp.src('src/styles/css/style.default.css') | |
| .pipe(gulp.dest(path.dest.css)); | |
| gulp.src('bower_components/font-awesome/css/font-awesome.min.css') | |
| .pipe(gulp.dest(path.dest.css)); | |
| gulp.src('bower_components/font-awesome/fonts/*') | |
| .pipe(gulp.dest(path.dest.fonts)); | |
| gulp.src('bower_components/simontabor/jquery-toggles/toggles.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| gulp.src('node_modules/angular-cookies/angular-cookies.min.js') | |
| .pipe(gulp.dest(path.dest.jslib)); | |
| }); | |
| gulp.task('js', function () { | |
| return gulp.src(path.scripts) | |
| .pipe(concat('main.js')) | |
| .pipe(gulp.dest('build/static/js')) | |
| .pipe(rename({suffix: '.min'})) | |
| .pipe(uglify({ | |
| compress: { | |
| sequences: false | |
| } | |
| })) | |
| .pipe(gulp.dest('build/static/js')); | |
| }); | |
| gulp.task('lint', function () { | |
| return gulp.src(path.scripts) | |
| .pipe(jshint()) | |
| .pipe(jshint.reporter('default')); | |
| }); | |
| gulp.task("sass", function () { | |
| return sass(path.sass) | |
| .on('error', sass.logError) | |
| .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) | |
| .pipe(gulp.dest('src/styles/css')) | |
| .pipe(concat('build.css')) | |
| .pipe(minifycss()) | |
| .pipe(rename({suffix: '.min'})) | |
| .pipe(gulp.dest('build/static/css')); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment