Advertisement
Guest User

Untitled

a guest
Aug 19th, 2015
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  *  Gulp vars
  3.  */
  4. var gulp        = require('gulp'),
  5.     clean       = require('gulp-clean'),
  6.     concat      = require('gulp-concat'),
  7.     notify      = require('gulp-notify'),
  8.     compass     = require('gulp-compass')
  9.     minifyCSS   = require('gulp-minify-css'),
  10.     livereload  = require('gulp-livereload'),
  11.  
  12. /*
  13.  *  Main paths
  14.  */
  15.     appPath     = 'app/',
  16.     bowerPath   = 'bower_components/',
  17.     publicPath  = 'public/',
  18.     gulpFile    = 'gulpfile.js',
  19.  
  20. /*
  21.  *  HTML
  22.  */
  23.     htmlViewsDest   = publicPath + 'html',
  24.     indexFile       = [appPath + '/layout/index.html'],
  25.     htmlViewsSrc    = ['!' + indexFile, appPath + '/**/*.html'],
  26.  
  27. /*
  28.  *  SASS
  29.  */
  30.     sassSrc         = 'sass/**/*.scss',
  31.     appSassFile     = 'sass/app.scss',
  32.     cssFilesDest    = publicPath + 'css',
  33.    
  34. /*
  35.  *  Media assets
  36.  */
  37.     imagesDest  = publicPath + 'img',
  38.     fontsDest   = publicPath + 'fonts',
  39.    
  40. /*
  41.  *  JavaScript
  42.  */
  43.     jsFilesDest     = publicPath + 'js',
  44.     appJsFile       = 'app.js',
  45.     jsFilesSrc      = [
  46.         // bower components
  47.         bowerPath + 'jquery/dist/jquery.min.js',
  48.         bowerPath + 'semantic-ui/dist/semantic.min.js',
  49.         bowerPath + 'angular/angular.js',
  50.         bowerPath + 'angular-animate/angular-animate.js',
  51.         bowerPath + 'angular-ui-router/release/angular-ui-router.js',
  52.         bowerPath + 'satellizer/satellizer.js',
  53.         bowerPath + 'ngDialog/js/ngDialog.js',
  54.  
  55.         // angular app
  56.         appPath + 'app.module.js',
  57.         appPath + 'app.config.js',
  58.         appPath + 'page.controller.js',
  59.         appPath + 'guest/guest.routes.js',
  60.         appPath + 'informations/informations.routes.js',
  61.         appPath + 'register/register.routes.js',
  62.         appPath + 'register/register.controller.js',
  63.         appPath + 'auth/auth.routes.js',
  64.         appPath + 'auth/logoutRedirect.config.js',
  65.         appPath + 'auth/register-form.directive.js',
  66.         appPath + 'auth/login-form.directive.js',
  67.         appPath + 'auth/auth.factory.js',
  68.         appPath + 'auth/auth.controller.js',
  69.         appPath + 'game/game.routes.js',
  70.         appPath + 'game/dropdown.directive.js',
  71.         appPath + 'game/game.controller.js',
  72.         appPath + 'modal/modal.provider.js',
  73.         appPath + 'layout/dynamicHeader.directive.js',
  74.         appPath + 'layout/dynamicFooter.directive.js',
  75.     ];
  76.  
  77. /*
  78.  *  GulpTask - Delete previous HTML views from public dir
  79.  */
  80. gulp.task('clean-html-views', function () {
  81.     return gulp.src(htmlViewsDest)
  82.         .pipe(clean());
  83. });
  84.  
  85. /*
  86.  *  GulpTask - Copy new HTML views to public dir
  87.  */
  88. gulp.task('copy-html-views', ['clean-html-views'], function () {
  89.     return gulp.src(htmlViewsSrc)
  90.         .pipe(gulp.dest(htmlViewsDest))
  91.         .pipe(livereload())
  92.         .pipe(notify({message: 'html files copied', onLast: true}));
  93. });
  94.  
  95. /*
  96.  *  GulpTask - Overwrite index.html in public dir
  97.  */
  98. gulp.task('copy-index', function () {
  99.     return gulp.src(indexFile)
  100.         .pipe(gulp.dest(publicPath))
  101.         .pipe(livereload())
  102.         .pipe(notify('index.html copied'));
  103. });
  104.  
  105. /*
  106.  *  GulpTask - JavaScript
  107.  */
  108. gulp.task('scripts', function() {
  109.     return gulp.src(jsFilesSrc)
  110.         .pipe(concat(appJsFile))
  111.         .pipe(gulp.dest(jsFilesDest))
  112.         .pipe(livereload())
  113.         .pipe(notify('scripts concatinated'));
  114. });
  115.  
  116. /*
  117.  *  GulpTask - SASS & Compass
  118.  */
  119. gulp.task('compass', function() {
  120.     return gulp.src(appSassFile)
  121.         .pipe(compass({
  122.             css: cssFilesDest,
  123.             font: fontsDest,
  124.             sass: 'sass',
  125.             image: imagesDest,
  126.             require: ['font-awesome-sass'],
  127.             import_path: ['bower_components/semantic-ui/dist']
  128.         }))
  129.         .pipe(minifyCSS())
  130.         .pipe(gulp.dest(cssFilesDest))
  131.         .pipe(livereload())
  132.         .pipe(notify({message: 'sass compiled', onLast: true}));
  133. });
  134.  
  135. /*
  136.  *  Gulp - Watch for changes
  137.  */
  138. gulp.task('watch', function() {
  139.     livereload.listen();
  140.     gulp.watch(htmlViewsSrc, ['copy-html-views']);
  141.     gulp.watch(indexFile, ['copy-index']);
  142.     gulp.watch(jsFilesSrc, ['scripts']);
  143.     gulp.watch(sassSrc, ['compass']);
  144.     gulp.watch(gulpFile, ['scripts', 'compass']);
  145. });
  146.  
  147. /*
  148.  *  Gulp - default
  149.  */
  150. gulp.task('default', ['watch', 'copy-html-views', 'copy-index', 'scripts', 'compass']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement