Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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_Templates_Gruntjs - Fatal编程技术网

Javascript 如何使grunt不解析模板变量?

Javascript 如何使grunt不解析模板变量?,javascript,templates,gruntjs,Javascript,Templates,Gruntjs,我有这样的Gruntfile.js: grunt.initConfig( { ... host : '/<%= STATICPATH %>/', ... replace : { dist : { options : { patterns : [ { json : { "hos

我有这样的Gruntfile.js:

grunt.initConfig( {
    ...
    host : '/<%= STATICPATH %>/',
    ...
    replace : { 
         dist : { 
             options : { 
                 patterns : [ { 
                     json : { 
                         "host" : "<%= host %>",
                         "path" : { 
                             "static" : "<%= host %>/",
                             "images" : "<%= host %>/images",
                             "js" : "<%= host %>/js",
                             "css" : "<%= host %>/css",
                             "font" : "<%= host %>/font"
                         }   
                     }   
                 } ] 
             },  
             files : [ { 
                 expand : true, 
                 src : [ 
                     '<%= dist %>/**/*.html',
                     '<%= dist %>/**/*.js',
                     '<%= dist %>/**/*.css'
                 ]   
             } ] 
         }, 
    }
} );
grunt.initConfig({
...
主机:“/”,
...
替换:{
地区:{
选项:{
模式:[{
json:{
“主机”:“,
“路径”:{
“静态”:“/”,
“图像”:“/图像”,
“js”:“/js”,
“css”:“/css”,
“字体”:“/font”
}   
}   
} ] 
},  
文件:[{
是的,
src:[
“/***/.html”,
“/***/.js”,
“/***.css”
]   
} ] 
}, 
}
} );
是我的应用程序中的模板变量,但不适用于Grunt,我想将代码中的某个地方替换为此。
但grunt总是将其解析为grunt模板变量。是否仍有解决此问题的方法?

是否有可能更改应用程序的模式(
)?@PrayagVerma恐怕我无法更改模式。这是一个老项目,没有一个好的方法来建造自己。我想将grunt添加到项目中,因此我遇到了这个问题。是否更改应用程序的模式(
)有可能?@PrayagVerma我恐怕无法更改模式。这是一个老项目,没有一个好的方法来建造自己。我想在项目中加入grunt,所以我遇到了这个麻烦