我目前正在创建一个脚本,将 html 网站转换为 WordPress 模板。
我知道您可以用文本替换文件中的文本和其他值。 但是还有一种方法可以用另一个变量的值替换它们吗?
I want to change the template name to the name the user sets before this``
.pipe(replace('TEMPLATENAME', '<%= pkg.name %>'))
当然,我现在得到的输出是:
register_nav_menus( array(
'primary' => __( 'Primary Menu', '<%= pkg.name %>' ),) );
最佳答案
如果您想要将 TEMPLATENAME
替换为 pkg.name
中的值,您应该执行以下操作:
.pipe(replace('TEMPLATENAME', pkg.name))
关于javascript - gulp 替换中的变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34200209/