1

i'm looking for a way to extend the build process of yeoman with something to minify json files ... i found a npm package which can minify json files but it doesn't export any functions :/ anyone that knows how to integrate this into the yeoman build process?

https://npmjs.org/package/json-minify

kind regards,

Daan

Daan Poron
  • 2,708
  • 5
  • 29
  • 33

1 Answers1

4

Here is a one liner to minify JSON in node.js: JSON.stringify(JSON.parse(jsonStr));

I threw together a grunt-minjson plugin. Install with npm install grunt-minjson --save-dev, add grunt.loadNpmTasks('grunt-minjson'); to your Gruntfile and configure like such:

grunt.initConfig({
  minjson: {
    compile: {
      files: {
        'all.min.json': ['jsonfiles/*.json']
      }
    }
  }
});

Here is a link to the project: https://github.com/shama/grunt-minjson

Kyle Robinson Young
  • 13,732
  • 1
  • 47
  • 38