2017-11-01 5 views
0

나는 플러그인을 관리하기 위해 축소와 npm에 grunt를 사용하고있다. 나는 아래에 나의 grunt 구성을 주었다. 툴 패스에서 파일 경로 지정하기

//Grunt configuration 
    module.exports = function(grunt) { 

     grunt.initConfig({ 
     pkg: grunt.file.readJSON('package.json'), 


     uglify: { 


      core_modules: { 
      options: { 
       beautify: false 
      }, 
      files: { 
       'resources/dist/core.min.js': [ "node_modules/jquery/dist/jquery.js", 
               "node_modules/angular/angular.js", 
               "node_modules/popper.js/dist/umd/popper.js", 
               "node_modules/bootstrap/dist/js/bootstrap.js", 
               "node_modules/jquery-ui-dist/jquery-ui.js", 
               "node_modules/angular-animate/angular-animate.js", 
               "node_modules/angular-material/angular-material.js", 
               "node_modules/angular-aria/angular-aria.js", 
               "node_modules/angular-sanitize/angular-sanitize.js", 
               "node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js", 
               "node_modules/@uirouter/angularjs/release/angular-ui-router.js" 
], 
      }, 
      }, 


     }, 

     }); 

     //Grunt Plugins 
     grunt.loadNpmTasks('grunt-contrib-uglify'); 


     //Default Tasks 
     grunt.registerTask('default', ['uglify']); 
    } 

내가 주면

"node_modules/**/*. JS"임 배열 형식의 파일 경로를 제공 있도록 모든 파일을 축소에있다. 쉽게 할 수있는 방법이 있습니까?

답변

0

는 해당 파일의 변수를 선언하고 dest로하는 값으로 변수를 줄 수

var files= [ "node_modules/jquery/dist/jquery.js", 
               "node_modules/angular/angular.js", 
               "node_modules/popper.js/dist/umd/popper.js", 
               "node_modules/bootstrap/dist/js/bootstrap.js", 
               "node_modules/jquery-ui-dist/jquery-ui.js", 
               "node_modules/angular-animate/angular-animate.js", 
               "node_modules/angular-material/angular-material.js", 
               "node_modules/angular-aria/angular-aria.js", 
               "node_modules/angular-sanitize/angular-sanitize.js", 
               "node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js", 
               "node_modules/@uirouter/angularjs/release/angular-ui-router.js" 
]; 
//Grunt configuration 
    module.exports = function(grunt) { 

     grunt.initConfig({ 
     pkg: grunt.file.readJSON('package.json'), 


     uglify: { 


      core_modules: { 
      options: { 
       beautify: false 
      }, 
      files: { 
       'resources/dist/core.min.js': files, 
      }, 
      }, 


     }, 

     }); 

     //Grunt Plugins 
     grunt.loadNpmTasks('grunt-contrib-uglify'); 


     //Default Tasks 
     grunt.registerTask('default', ['uglify']); 
    }