blob: f833fb8eadbbce1da997d9dc666109821bf1de48 [file] [log] [blame]
Matteo Scandolob0238d32015-11-04 16:03:59 +01001var gulp = require('gulp');
2var uglify = require('gulp-uglify');
Matteo Scandolo45a5c562016-04-13 16:20:13 -07003var concat = require('gulp-concat');
Matteo Scandolob0238d32015-11-04 16:03:59 +01004var ngAnnotate = require('gulp-ng-annotate');
5var angularFilesort = require('gulp-angular-filesort');
Matteo Scandolo45a5c562016-04-13 16:20:13 -07006var gulpDocs = require('gulp-ngdocs');
Matteo Scandolo717352a2016-04-13 17:23:28 -07007var del = require('del');
Matteo Scandolob0238d32015-11-04 16:03:59 +01008
9module.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 Scandolo45a5c562016-04-13 16:20:13 -070018
Matteo Scandolo717352a2016-04-13 17:23:28 -070019 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 Scandolo45a5c562016-04-13 16:20:13 -070051 });
Matteo Scandolob0238d32015-11-04 16:03:59 +010052};