unique config.json for grunt uglify

141 views Asked by At

Hi I'm trying to make a config.json, that feeds the uglify with src-files, so we easily can include/exclude files, based on the nature of the project. I would like to use the projects name (<%= pkg.name %>) to give a unique name to the config.json as the example below, but this isn't working. Any clues to a solution?

    uglify: {
     ....
       files: {
          'assets/js/default.min.js': grunt.file.readJSON( 'assets/js/config-<%= pkg.name %>.json' )
          }
       }
    },

Example of the config.json:

**[

"assets/js/vendor/jquery.js",
"assets/js/vendor/jquery.cookie.js",
"assets/js/vendor/bootstrap-alert.js",
"assets/js/vendor/bootstrap-button.js",
"assets/js/vendor/bootstrap-carousel.js",
"assets/js/vendor/bootstrap-collapse.js",
"assets/js/vendor/bootstrap-affix.js",
"assets/js/vendor/blueimp-gallery.js",

]**

1

There are 1 answers

1
Jscti On
uglify: {
     ....
       files: {
          'assets/js/default.min.js': 'assets/js/config-<%= pkg.name %>.json'
          }
       }
    },

should work without the need of manually reading the JSON file