Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取Grunt中当前处理文件夹的名称?_Javascript_Css_Npm_Gruntjs - Fatal编程技术网

Javascript 获取Grunt中当前处理文件夹的名称?

Javascript 获取Grunt中当前处理文件夹的名称?,javascript,css,npm,gruntjs,Javascript,Css,Npm,Gruntjs,我想获得Grunt正在处理的当前文件夹的名称,这样我就可以将特定于页面的CSS与Grunt contrib html build之类的东西内联在一起 文件夹结构示例: app - home - home.html - home.module.js - home.controller.js - help - help.html - etc - styles - home.css - help.css 应用程序 -家 -home.html -home.

我想获得Grunt正在处理的当前文件夹的名称,这样我就可以将特定于页面的CSS与Grunt contrib html build之类的东西内联在一起

文件夹结构示例:

app - home - home.html - home.module.js - home.controller.js - help - help.html - etc - styles - home.css - help.css 应用程序 -家 -home.html -home.module.js -home.controller.js -帮助 -help.html -等 -风格 -home.css -help.css 然后,在构建过程中,我希望包含/styles/%current\u dir\u name%.css inline,其中home.html包含/styles/home.css,help.html包含/styles/help.css


也许我做得不对,我在grunt中尝试了一些方法,但我似乎无法获得这些数据。

如果我进入buld-html.js,我可以在grunt.files.forEach(function(file)>file.src.forEach(function(src)>src.match(/(?!。+\/)+(?=\)/g下获得这些数据。我只是不确定如何在grunt文件中访问该文件,因为我不想修改插件。如果不修改插件,或者不在插件周围编写自己的包装,您将无法访问该文件。数据不会暴露在该模块之外。