Gruntjs grunt bowercopy 2配置文件开发和生产

Gruntjs grunt bowercopy 2配置文件开发和生产,gruntjs,bower,minify,Gruntjs,Bower,Minify,嗨,在Grunt上的bowercopy任务上有两个“概要文件”,一个用于开发,另一个用于生产,最好的方式是什么 在dev上,我希望复制所有未缩小的版本,在产品上,复制缩小的版本 我试着使用grunt.option创建后缀(min.js或.js),但仍然无法找到一种不重复的方法 在这个阶段,我也不想使用uglify,因为文件已经作为bower_组件存在 我也不想使用maps,因为它是ripple cordova应用程序,我不想将非种子文件复制到构建中 我对“咕噜世界”有点陌生,我想可能有一个简单的

嗨,在Grunt上的bowercopy任务上有两个“概要文件”,一个用于开发,另一个用于生产,最好的方式是什么

在dev上,我希望复制所有未缩小的版本,在产品上,复制缩小的版本

我试着使用grunt.option创建后缀(min.js或.js),但仍然无法找到一种不重复的方法

在这个阶段,我也不想使用uglify,因为文件已经作为bower_组件存在

我也不想使用maps,因为它是ripple cordova应用程序,我不想将非种子文件复制到构建中

我对“咕噜世界”有点陌生,我想可能有一个简单的方法


谢谢

请参阅下面的grunt文件

module.exports = function(grunt) {


    grunt.initConfig({
        bowercopy: 
        {
            options: 
            {
                // Task-specific options go here
                runBower : false
                ,nonull: true
            },
             development: 
             {
                options: {
                    destPrefix: "www"
                },
                files: {
                    // Keys are destinations (prefixed with `options.destPrefix`)
                    // Values are sources (prefixed with `options.srcPrefix`); One source per destination
                    // e.g. 'bower_components/chai/lib/chai.js' will be copied to 'test/js/libs/chai.js'
                    '/Scripts/thirdParty/jquery.js': 'jquery/dist/jquery.js'
                }
            },
             production: 
             {
                options: {
                    destPrefix: "www"
                },
                files: {
                    '/Scripts/thirdParty/jquery.js': 'jquery/dist/jquery.min.js',
                 }


               }    

    }

    });


grunt.loadNpmTasks('grunt-bowercopy');



grunt.registerTask('buildDevelopment', ['bowercopy:development']);

grunt.registerTask('buildProduction', ['bowercopy:production']);

grunt.registerTask('default', ['buildDevelopment']);


}
然后再跑

$ grunt
Running "bowercopy:development" (bowercopy) task
bower_components/jquery/dist/jquery.js -> www/Scripts/thirdParty/jquery.js

Done, without errors.

$ grunt buildProduction
Running "bowercopy:production" (bowercopy) task
bower_components/jquery/dist/jquery.min.js -> www/Scripts/thirdParty/jquery.js

Done, without errors.

嗨,Atilla,这正是我“经过一些研究后”想到的。我想知道是否有一种方法可以传递变量,这样我就可以只声明一次文件,并读取一个后缀变量(无论是.min.js还是.js),以避免重复files@LuizRolim如果对你有用的话,如果你能接受我的回答,我将不胜感激,有用,我把它标记为有用。我只是稍等一下,看看是否有人提出了“统一”的方法,但我开始怀疑是否有这种方法。