简体   繁体   English

Grunt / Docker文件路径

[英]Grunt / Docker file paths

I'm running Grunt and can't get docker (jsdocs) to place it's generated files in an external folder. 我正在运行Grunt并且无法让docker(jsdocs)将其生成的文件放在外部文件夹中。 Regardless of what "dest" I pass, it still places the generated html files in the same directory as the javascript files. 无论我传递的是什么“dest”,它仍然将生成的html文件放在与javascript文件相同的目录中。

Grunt build -v logs: Grunt构建-v日志:

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.

My config 我的配置

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"
                }
            }
        },

Based on the command line logs, sounds like running that grunt file on a windows box hence this regular expression; 基于命令行日志,听起来像在Windows框上运行该grunt文件,因此这个正则表达式;

cwd: String(global_scripts_folder).replace(/\\\\\\\\/g, "/").replace(/\\\\/g, "/")

could cause you grieve simply because; 可能会让你感到悲伤,因为; Windows directory paths are based on \\ forward slash. Windows目录路径基于\\ forward slash。

The trouble here is that the regexpr is trying to turn all the forward slashes into back slashes which would work if this Grunt file is ported from a Windows to a Linux environment. 这里的问题是regexpr试图将所有正斜杠转换为反斜杠,如果将这个Grunt文件从Windows移植到Linux环境,这将起作用。

Q: It's just strange how it prints all of the destination paths correctly and then doesn't place the generated files in them. 问:如何正确打印所有目标路径,然后不将生成的文件放入其中,这一点很奇怪。

A: I think the -v verbose mode from Grunt is reporting things correctly. 答:我认为Grunt的-v verbose模式正确报告了事情。 It is just that the file is now named as jsdocs/datatables-functions.js instead of just datatables-function.js . 只是该文件现在命名为jsdocs/datatables-functions.js而不仅仅是datatables-function.js Somehow windows must have interpret that as a full file name. 不知何故,Windows必须将其解释为完整的文件名。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM