/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; // generated on 2014-06-25 using generator-gulp-webapp 0.1.0 var gulp = require('gulp'); // load plugins var $ = require('gulp-load-plugins')(); gulp.task('styles', function () { return gulp.src('app/styles/main.css') .pipe($.autoprefixer('last 1 version')) .pipe(gulp.dest('.tmp/styles')) .pipe($.size()); }); gulp.task('html', ['styles'], function () { var jsFilter = $.filter('**/*.js'); var cssFilter = $.filter('**/*.css'); return gulp.src('app/*.html') .pipe($.plumber()) .pipe($.useref.assets({searchPath: '{.tmp,app}'})) .pipe(jsFilter) .pipe($.uglify()) .pipe(jsFilter.restore()) .pipe(cssFilter) .pipe(cssFilter.restore()) .pipe($.useref.restore()) .pipe($.useref()) .pipe(gulp.dest('dist')) .pipe($.size()); }); gulp.task('views', function() { return gulp.src('app/views/**/*.html') .pipe(gulp.dest('dist/views')); }); gulp.task('images', function () { return gulp.src('app/images/**/*') .pipe(gulp.dest('dist/images')) .pipe($.size()); }); gulp.task('fonts', function () { return $.bowerFiles() .pipe($.filter('**/*.{eot,svg,ttf,woff}')) .pipe($.flatten()) .pipe(gulp.dest('dist/fonts')) .pipe($.size()); }); gulp.task('extras', function () { return gulp.src(['app/*.*', '!app/*.html'], { dot: true }) .pipe(gulp.dest('dist')); }); gulp.task('clean', function () { return gulp.src(['.tmp', 'dist'], { read: false }).pipe($.clean()); }); gulp.task('build', ['html', 'views', 'images', 'fonts', 'extras']); gulp.task('default', ['clean'], function () { gulp.start('build'); });