我正在运行Grunt并且无法让docker(jsdocs)将其生成的文件放在外部文件夹中。无论我传递的是什么“dest”,它仍然将生成的html文件放在与javascript文件相同的目录中。
Grunt build -v logs:
Running "docker:build" (docker) task
Verifying property docker.build exists in config...OK
Files: C:/mysite/src/html/scripts/components/app-helpers.js -> jsdocs/app-helpers.js
Files: C:/mysite/src/html/scripts/components/datatables-functions.js -> jsdocs/datatables-functions.js
Files: C:/mysite/src/html/scripts/components/highcharts-functions.js -> jsdocs/highcharts-functions.js
Files: C:/mysite/src/html/scripts/components/pagination.js -> jsdocs/pagination.js
Files: C:/mysite/src/html/scripts/components/resizer.js -> jsdocs/resizer.js
Files: C:/mysite/src/html/scripts/components/slideout.js -> jsdocs/slideout.js
Files: C:/mysite/src/html/scripts/components/tabs.js -> jsdocs/tabs.js
Files: C:/mysite/src/html/scripts/components/ui.js -> jsdocs/ui.js
Files: C:/mysite/src/html/scripts/components/widget.js -> jsdocs/widget.js
Files: C:/mysite/src/html/scripts/components/widgets/cards.js -> jsdocs/cards.js
Files: C:/mysite/src/html/scripts/components/widgets/figures.js -> jsdocs/figures.js
Files: C:/mysite/src/html/scripts/components/widgets/flip-card.js -> jsdocs/flip-card.js
Files: C:/mysite/src/html/scripts/components/widgets/list-view.js -> jsdocs/list-view.js
Files: C:/mysite/src/html/scripts/components/widgets/projects.js -> jsdocs/projects.js
Options: onlyUpdated=false, colourScheme="default", ignoreHidden=false, sidebarState, exclude=false, lineNums=false, js=[], css=[], extras=[]
Options: onlyUpdated=false, colourScheme="default", ignoreHidden=false, sidebarState, exclude=false, lineNums=false, js=[], css=[], extras=[]
Destination: jsdocs/app-helpers.js
Destination: jsdocs/datatables-functions.js
Destination: jsdocs/highcharts-functions.js
Destination: jsdocs/pagination.js
Destination: jsdocs/resizer.js
Destination: jsdocs/slideout.js
Destination: jsdocs/tabs.js
Destination: jsdocs/ui.js
Destination: jsdocs/widget.js
Destination: jsdocs/cards.js
Destination: jsdocs/figures.js
Destination: jsdocs/flip-card.js
Destination: jsdocs/list-view.js
Destination: jsdocs/projects.js
Generated: C:\mysite\src\html\scripts\components\app-helpers.js.html
Generated: C:\mysite\src\html\scripts\components\datatables-functions.js.html
Generated: C:\mysite\src\html\scripts\components\highcharts-functions.js.html
Generated: C:\mysite\src\html\scripts\components\pagination.js.html
Generated: C:\mysite\src\html\scripts\components\resizer.js.html
Generated: C:\mysite\src\html\scripts\components\slideout.js.html
Generated: C:\mysite\src\html\scripts\components\tabs.js.html
Generated: C:\mysite\src\html\scripts\components\ui.js.html
Generated: C:\mysite\src\html\scripts\components\widget.js.html
Generated: C:\mysite\src\html\scripts\components\widgets\cards.js.html
Generated: C:\mysite\src\html\scripts\components\widgets\figures.js.html
Generated: C:\mysite\src\html\scripts\components\widgets\flip-card.js.html
Generated: C:\mysite\src\html\scripts\components\widgets\list-view.js.html
Generated: C:\mysite\src\html\scripts\components\widgets\projects.js.html
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Copied default.css to doc-style.css
Done.
我的配置
docker: {
build: {
expand: true,
flatten: true,
cwd: String(global_scripts_folder).replace(/\\\\/g, "/").replace(/\\/g, "/"),
src: ['components/**/*.js'],
dest: 'jsdocs',
options: {
//template : "node_modules/ink-docstrap/cosmo",
//configure : "node_modules/ink-docstrap/template/jsdoc.conf.json"
}
}
},
答案 0 :(得分:0)
根据命令行日志,听起来像在Windows框上运行那个grunt文件,因此这个正则表达式;
cwd: String(global_scripts_folder).replace(/\\\\/g, "/").replace(/\\/g, "/")
可能会让你感到悲伤,因为; Windows目录路径基于\
正斜杠。
这里的问题是regexpr试图将所有正斜杠转换为反斜杠,如果将这个Grunt文件从Windows移植到Linux环境,这将起作用。
问:如何正确打印所有目标路径,然后将生成的文件放入其中,这一点很奇怪。
答:我认为Grunt的-v
详细模式正确报道了事情。只是该文件现在命名为jsdocs/datatables-functions.js
,而不仅仅是datatables-function.js
。不知何故,Windows必须将其解释为完整的文件名。
希望这有帮助。