使用grunt-bower时忽略包目标路径

时间:2014-12-22 19:22:40

标签: gruntjs bower

我正在尝试使用grunt / bower进行项目,我有以下内容结构:

content 
    css
    js

我已经让咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜咕噜content/js/dist/jquery.js。换句话说,我想在复制文件时删除/忽略content/js/jquery.js文件夹。到目前为止,我的任务看起来像这样:

dist

如何告诉bower任务将 bower: { install: {}, dev: { dest: 'Content', js_dest: 'Content/js', less_dest: 'Content/css', css_dest: 'Content/css', options: { packageSpecific: { "jquery": { dest: 'Content/js' } } } } }, 从jquery包文件复制到我应用中的特定路径dist/jquery.js

1 个答案:

答案 0 :(得分:0)

您可以使用 keepExpandedHierarchy 选项(展平输出结构)来实现此行为。你可以专门为jquery设置:

bower: {
    install: {},
    dev: {
        dest: 'Content',
        js_dest: 'Content/js',
        less_dest: 'Content/css',
        css_dest: 'Content/css',
        options: {
            packageSpecific: {
                'jquery': {
                  keepExpandedHierarchy: false
                }
            }
        }
    }
}

运行grunt bower时,jquery.js文件被复制到Content \ js \ jquery.js:

>grunt bower
Running "bower:install" (bower) task

Running "bower:dev" (bower) task
Content\js\jquery.js copied.

Done, without errors.