简体   繁体   English

grunt-injector-如何使用Grunt的“动态构建文件对象”?

[英]grunt-injector - how to use Grunt's 'dynamically built files objects.'?

Grunt's dynamically built files objects is in the structure of: Grunt动态构建的文件对象的结构如下:

files: [
        {
          expand: true,     // Enable dynamic expansion.
          cwd: 'lib/',      // Src matches are relative to this path.
          src: ['**/*.js'], // Actual pattern(s) to match.
          dest: 'build/',   // Destination path prefix.
          ext: '.min.js',   // Dest filepaths will have this extension.
          extDot: 'first'   // Extensions in filenames begin after the first dot
        },
]

But this format does not work in grunt-injector: 但是这种格式在grunt-injector中不起作用:

injector: {
    options: {
    destFile : 'app/static/index.html',
    ignorePath: 'app/'
    }, 
    local_dependencies: {
    files:  [
            expand: true,
            cwd: 'app/static/css/',
            src: ['*.css'],
            dest: '/static/css',
            ext: '.css'
            ]  
    }  
}, 

Any suggestions on how I can use Grunt's specific 'dynamically built files objects' with it? 关于如何将Grunt的特定“动态构建文件对象”与之配合使用的任何建议?

If anyone has this issue, I guess you can not use sub categories like local_dependencies. 如果有人遇到此问题,我想您不能使用像local_dependencies这样的子类别。

This worked for me: 这为我工作:

    injector: {
        options: {
        destFile : 'app/static/index.html',
        ignorePath: 'app/'
        }, 
            files: {
                expand: true,
                cwd: 'app/static/css/',
                src: ['*.css'],
                dest: 'app/static/css',
                ext: '.css'
                }
    }, 

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

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