Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Gulp vars
- */
- var gulp = require('gulp'),
- clean = require('gulp-clean'),
- concat = require('gulp-concat'),
- notify = require('gulp-notify'),
- compass = require('gulp-compass')
- minifyCSS = require('gulp-minify-css'),
- livereload = require('gulp-livereload'),
- /*
- * Main paths
- */
- appPath = 'app/',
- bowerPath = 'bower_components/',
- publicPath = 'public/',
- gulpFile = 'gulpfile.js',
- /*
- * HTML
- */
- htmlViewsDest = publicPath + 'html',
- indexFile = [appPath + '/layout/index.html'],
- htmlViewsSrc = ['!' + indexFile, appPath + '/**/*.html'],
- /*
- * SASS
- */
- sassSrc = 'sass/**/*.scss',
- appSassFile = 'sass/app.scss',
- cssFilesDest = publicPath + 'css',
- /*
- * Media assets
- */
- imagesDest = publicPath + 'img',
- fontsDest = publicPath + 'fonts',
- /*
- * JavaScript
- */
- jsFilesDest = publicPath + 'js',
- appJsFile = 'app.js',
- jsFilesSrc = [
- // bower components
- bowerPath + 'jquery/dist/jquery.min.js',
- bowerPath + 'semantic-ui/dist/semantic.min.js',
- bowerPath + 'angular/angular.js',
- bowerPath + 'angular-animate/angular-animate.js',
- bowerPath + 'angular-ui-router/release/angular-ui-router.js',
- bowerPath + 'satellizer/satellizer.js',
- bowerPath + 'ngDialog/js/ngDialog.js',
- // angular app
- appPath + 'app.module.js',
- appPath + 'app.config.js',
- appPath + 'page.controller.js',
- appPath + 'guest/guest.routes.js',
- appPath + 'informations/informations.routes.js',
- appPath + 'register/register.routes.js',
- appPath + 'register/register.controller.js',
- appPath + 'auth/auth.routes.js',
- appPath + 'auth/logoutRedirect.config.js',
- appPath + 'auth/register-form.directive.js',
- appPath + 'auth/login-form.directive.js',
- appPath + 'auth/auth.factory.js',
- appPath + 'auth/auth.controller.js',
- appPath + 'game/game.routes.js',
- appPath + 'game/dropdown.directive.js',
- appPath + 'game/game.controller.js',
- appPath + 'modal/modal.provider.js',
- appPath + 'layout/dynamicHeader.directive.js',
- appPath + 'layout/dynamicFooter.directive.js',
- ];
- /*
- * GulpTask - Delete previous HTML views from public dir
- */
- gulp.task('clean-html-views', function () {
- return gulp.src(htmlViewsDest)
- .pipe(clean());
- });
- /*
- * GulpTask - Copy new HTML views to public dir
- */
- gulp.task('copy-html-views', ['clean-html-views'], function () {
- return gulp.src(htmlViewsSrc)
- .pipe(gulp.dest(htmlViewsDest))
- .pipe(livereload())
- .pipe(notify({message: 'html files copied', onLast: true}));
- });
- /*
- * GulpTask - Overwrite index.html in public dir
- */
- gulp.task('copy-index', function () {
- return gulp.src(indexFile)
- .pipe(gulp.dest(publicPath))
- .pipe(livereload())
- .pipe(notify('index.html copied'));
- });
- /*
- * GulpTask - JavaScript
- */
- gulp.task('scripts', function() {
- return gulp.src(jsFilesSrc)
- .pipe(concat(appJsFile))
- .pipe(gulp.dest(jsFilesDest))
- .pipe(livereload())
- .pipe(notify('scripts concatinated'));
- });
- /*
- * GulpTask - SASS & Compass
- */
- gulp.task('compass', function() {
- return gulp.src(appSassFile)
- .pipe(compass({
- css: cssFilesDest,
- font: fontsDest,
- sass: 'sass',
- image: imagesDest,
- require: ['font-awesome-sass'],
- import_path: ['bower_components/semantic-ui/dist']
- }))
- .pipe(minifyCSS())
- .pipe(gulp.dest(cssFilesDest))
- .pipe(livereload())
- .pipe(notify({message: 'sass compiled', onLast: true}));
- });
- /*
- * Gulp - Watch for changes
- */
- gulp.task('watch', function() {
- livereload.listen();
- gulp.watch(htmlViewsSrc, ['copy-html-views']);
- gulp.watch(indexFile, ['copy-index']);
- gulp.watch(jsFilesSrc, ['scripts']);
- gulp.watch(sassSrc, ['compass']);
- gulp.watch(gulpFile, ['scripts', 'compass']);
- });
- /*
- * Gulp - default
- */
- gulp.task('default', ['watch', 'copy-html-views', 'copy-index', 'scripts', 'compass']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement