grunt-update-json icon indicating copy to clipboard operation
grunt-update-json copied to clipboard

I am having troubles with syncing my custom JSON with bower.json

Open Grawl opened this issue 11 years ago • 0 comments

Hello! I found this plugin useful to sync two fields in my project:

bower_components/jquery/bower.json

{
  "name": "jquery",
  "version": "2.1.1", <-- FROM
  "main": "dist/jquery.js",
  …
}

locals.json

{
    …
    "bower": {
        "jquery": {
            "version": "" <-- TO
        }
    }
}

I need it to reach this field from Jade local variables.

So I installed grunt-update-json and added this:

gruntfile.coffee

        update_json:
            locals_jquery:
                src:'bower_components/jquery/bower.json'
                dest:'locals.json'
                fields:[{
                    bower: [{
                        jquery: [{
                            version:'version'
                        }]
                    }]
                }]

But it didn't work.

Then I tried to change fields to this:

                fields:[
                    'bower/jquery/version': 'version'
                ]

But it didn't work too.

I tried to add slashes to start, to end, to start and end of internal JSON variable path bower/jquery/version, but without luck every time.

So how I can do it?

Grawl avatar Jul 01 '14 00:07 Grawl