在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):nikhilmodak/gulp-ngdocs开源软件地址(OpenSource Url):https://github.com/nikhilmodak/gulp-ngdocs开源编程语言(OpenSource Language):JavaScript 94.8%开源软件介绍(OpenSource Introduction):gulp-ngdocsGulp plugin for building AngularJS like documentation. This is inspired from grunt-ngdocs. ##Setup
##Usage Create a gulp.task('ngdocs', [], function () {
var gulpDocs = require('gulp-ngdocs');
return gulp.src('path/to/src/*.js')
.pipe(gulpDocs.process())
.pipe(gulp.dest('./docs'));
}); Create a gulp.task('ngdocs', [], function () {
var gulpDocs = require('gulp-ngdocs');
var options = {
scripts: ['../app.min.js'],
html5Mode: true,
startPage: '/api',
title: "My Awesome Docs",
image: "path/to/my/image.png",
imageLink: "http://my-domain.com",
titleLink: "/api"
}
return gulp.src('path/to/src/*.js')
.pipe(gulpDocs.process(options))
.pipe(gulp.dest('./docs'));
}); To use a different AngularJS version pass gulp.task('ngdocs', [], function () {
var gulpDocs = require('gulp-ngdocs');
var options = {
/* pass both .min.js and .min.js.map files for angular and angular-animate */
scripts: [
'bower_components/angular/angular.min.js',
'bower_components/angular/angular.min.js.map',
'bower_components/angular-animate/angular-animate.min.js',
'bower_components/angular-animate/angular-animate.min.js.map'
]
}
/*
If you choose to use the remote links pass in the .min.js links for angular and angular-animate
var options = {
scripts: [
'http://ajax.googleapis.com/ajax/libs/angularjs/<version>/angular.min.js',
'http://ajax.googleapis.com/ajax/libs/angularjs/<version>/angular-animate.min.js'
]
}
*/
return gulp.src('path/to/src/*.js')
.pipe(gulpDocs.process(options))
.pipe(gulp.dest('./docs'));
}); If you would like to divide your documentation into different sections, use gulp.task('ngdocs', [], function () {
var gulpDocs = require('gulp-ngdocs');
var options = {
//options
}
return gulpDocs.sections({
api: {
glob:['src/**/*.js', '!src/**/*.spec.js'],
api: true,
title: 'API Documentation'
},
tutorial: {
glob: ['content/tutorial/*.ngdoc'],
title: 'Tutorial'
}
}).pipe(gulpDocs.process(options)).pipe(gulp.dest('./docs'));
}); Serving index.html fileOpening index.html file via file:// protocol will cause a number of troubles. The easier way to avoid it is to run local server. As an options you can use gulp-connect
###Doc comment example A doc comment looks like this: /**
* @ngdoc directive
* @name rfx.directive:rAutogrow
* @element textarea
* @function
*
* @description
* Resize textarea automatically to the size of its text content.
*
* **Note:** ie<9 needs polyfill for window.getComputedStyle
*
* @example
<example module="rfx">
<file name="index.html">
<textarea ng-model="text"rx-autogrow class="input-block-level"></textarea>
<pre>{{text}}</pre>
</file>
</example>
*/
angular.module('rfx', []).directive('rAutogrow', function() {
//some nice code
}); Check out the Writing AngularJS documentation wiki article to see what's possible, or take a look at the AngularJS source code for more examples. ##Options ####scripts Set additional custom JS files are loaded to the app. This allows the live examples to use custom directives, services, etc. The documentation app works with AngularJS 1.2+ and 1.3+. If you include a different version of AngularJS, make sure to include angular-animate.js as well. Possible values:
####styles
[default] ####analytics Optional include Google Analytics in the documentation app. Example usage: var opts = {
analytics: {
account: 'UA-XXXXXX-YY',
domainName: 'http://mywebpage.com/'
}
}; ####discussions Optional include discussions in the documentation app. ####editExample
[default] ####title
[default] ####startPage
[default] ####html5Mode
[default] ####image A URL or relative path to an image file to use in the top navbar. ####titleLink [default] no anchor tag is used Wraps the title text in an anchor tag with the provided URL. ####imageLink [default] no anchor tag is used Wraps the navbar image in an anchor tag with the provided URL. ####bestMatch
[default] ####navTemplate
[default] <header class="header">
<div class="navbar">
<ul class="nav">
{{links to all the docs pages}}
</ul>
{{YOUR_NAV_TEMPLATE_GOES_HERE}}
</div>
</header> Example: 'templates/my-nav.html' The template, if specified, is pre-processed using _.template. ####loadDefaults
Use this option to disable any of the four scripts Example usage: var opts = {
loadDefaults: {
angularAnimate: false
}
} ##Options for Sections ####glob [required] glob pattern of files to parse for documentation comments. ###title [default] name of the section. Set the title for the section in the documentation app. ###api [default] |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论