Matteo Scandolo | b0238d3 | 2015-11-04 16:03:59 +0100 | [diff] [blame] | 1 | var gulp = require('gulp'); |
| 2 | var uglify = require('gulp-uglify'); |
Matteo Scandolo | 45a5c56 | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 3 | var concat = require('gulp-concat'); |
Matteo Scandolo | b0238d3 | 2015-11-04 16:03:59 +0100 | [diff] [blame] | 4 | var ngAnnotate = require('gulp-ng-annotate'); |
| 5 | var angularFilesort = require('gulp-angular-filesort'); |
Matteo Scandolo | 45a5c56 | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 6 | var gulpDocs = require('gulp-ngdocs'); |
Matteo Scandolo | 717352a | 2016-04-13 17:23:28 -0700 | [diff] [blame] | 7 | var del = require('del'); |
Matteo Scandolo | b0238d3 | 2015-11-04 16:03:59 +0100 | [diff] [blame] | 8 | |
| 9 | module.exports = function(options){ |
| 10 | gulp.task('helpers', function(){ |
| 11 | return gulp.src([options.xosHelperSource + '**/*.js']) |
| 12 | .pipe(angularFilesort()) |
| 13 | .pipe(concat('ngXosHelpers.js')) |
| 14 | .pipe(ngAnnotate()) |
| 15 | .pipe(uglify()) |
| 16 | .pipe(gulp.dest(options.ngXosVendor)); |
| 17 | }); |
Matteo Scandolo | 45a5c56 | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 18 | |
Matteo Scandolo | 717352a | 2016-04-13 17:23:28 -0700 | [diff] [blame] | 19 | gulp.task('cleanDocs', function(){ |
| 20 | console.log(options); |
| 21 | return del([options.docs + '**/*']); |
| 22 | }); |
| 23 | |
| 24 | gulp.task('docs', ['cleanDocs'], function(){ |
| 25 | var ngOptions = { |
| 26 | scripts: [ |
| 27 | 'http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js', |
| 28 | 'http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.min.js' |
| 29 | ], |
| 30 | html5Mode: true, |
| 31 | title: 'XOS Helpers documentation', |
| 32 | startPage: '/module', |
| 33 | } |
| 34 | |
| 35 | return gulpDocs.sections({ |
| 36 | module: { |
| 37 | glob: [ |
| 38 | options.xosHelperSource + '*.js', |
| 39 | options.xosHelperSource + 'services/*.js' |
| 40 | ], |
| 41 | title: 'Module Documentation', |
| 42 | }, |
| 43 | 'rest-api': { |
| 44 | glob: [ |
| 45 | options.xosHelperSource + 'services/rest/*.js' |
| 46 | ], |
| 47 | api: true, |
| 48 | title: 'API Documentation', |
| 49 | } |
| 50 | }).pipe(gulpDocs.process(ngOptions)).pipe(gulp.dest('./docs')); |
Matteo Scandolo | 45a5c56 | 2016-04-13 16:20:13 -0700 | [diff] [blame] | 51 | }); |
Matteo Scandolo | b0238d3 | 2015-11-04 16:03:59 +0100 | [diff] [blame] | 52 | }; |