comparison foodtruckui/gulpfile.js @ 587:d4a01a023998

admin: Add "FoodTruck" admin panel from the side experiment project.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 16 Jan 2016 14:24:35 -0800
parents
children
comparison
equal deleted inserted replaced
586:59268b4d8c71 587:d4a01a023998
1 'use strict';
2
3 var gulp = require('gulp'),
4 util = require('gulp-util'),
5 sass = require('gulp-sass'),
6 sourcemaps = require('gulp-sourcemaps'),
7 rename = require('gulp-rename'),
8 minify = require('gulp-minify-css'),
9 concat = require('gulp-concat'),
10 uglify = require('gulp-uglify');
11
12 // Stylesheets
13 gulp.task('sass', function() {
14 //util.log("Generating CSS");
15 return gulp.src('assets/sass/**/*.scss')
16 //.pipe(sourcemaps.init())
17 .pipe(sass({
18 errLogToConsole: true,
19 outputStyle: 'compressed',
20 includePaths: [
21 'bower_components/bootstrap-sass/assets/stylesheets',
22 'bower_components/Ionicons/scss']}))
23 //.pipe(sourcemaps.write())
24 .pipe(rename({suffix: '.min'}))
25 .pipe(minify())
26 .pipe(gulp.dest('../foodtruck/static/css'));
27 });
28 gulp.task('sass:watch', function() {
29 return gulp.watch('assets/sass/**/*.scss', ['sass']);
30 });
31
32 // Javascript
33 gulp.task('js', function() {
34 return gulp.src([
35 'bower_components/jquery/dist/jquery.js',
36 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/alert.js',
37 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/button.js',
38 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse.js',
39 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js',
40 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js',
41 'bower_components/bootstrap-sass/assets/javascripts/bootstrap/transition.js',
42 'assets/js/**/*.js'
43 ])
44 .pipe(sourcemaps.init())
45 .pipe(concat('foodtruck.js'))
46 .pipe(sourcemaps.write())
47 .pipe(rename({suffix: '.min'}))
48 //.pipe(uglify())
49 .pipe(gulp.dest('../foodtruck/static/js'));
50 });
51 gulp.task('js:watch', function() {
52 return gulp.watch('assets/js/**/*.js', ['js']);
53 });
54
55 // Fonts/images
56 gulp.task('fonts', function() {
57 return gulp.src([
58 'bower_components/bootstrap-sass/assets/fonts/bootstrap/*',
59 'bower_components/Ionicons/fonts/*'
60 ])
61 .pipe(gulp.dest('../foodtruck/static/fonts'));
62 });
63
64 gulp.task('images', function() {
65 return gulp.src([
66 'bower_components/bootstrap-sass/assets/images/*',
67 'assets/img/*'
68 ])
69 .pipe(gulp.dest('../foodtruck/static/img'));
70 });
71
72 // Launch tasks
73 gulp.task('default', function() {
74 gulp.start(['sass', 'js', 'fonts', 'images']);
75 });
76
77 gulp.task('watch', function() {
78 gulp.start(['sass:watch', 'js:watch']);
79 });
80