grunt-assets-versioning icon indicating copy to clipboard operation
grunt-assets-versioning copied to clipboard

Unable to process multiple files

Open ruudboon opened this issue 9 years ago • 2 comments

Trying to version multiple files unfortunately I keep having a warning: Task 'assets_versioning:files' doesn't have any src-dest file mappings.

assets_versioning: {
            options: {
                tag: 'hash',
                hashLength: 6,
                versionsMapFile: './apps/frontend/assets/version.json'
            },
            files: {
                './public_html/css/file1.css' : './public_html/css/file1.css',
                './public_html/css/file2.min.css' : './public_html/css/file2.min.css'
            }
        }

Also tried this approach. But this is giving: Object #<Object> has no method 'indexOf'

 assets_versioning: {
            options: {
                tag: 'hash',
                hashLength: 6,
                versionsMapFile: './apps/frontend/assets/version.json'
            },
            files: [
                {
                    src: './public_html/css/file1.min.css',
                    dest: './public_html/css/file1.min.css',
                },
                {
                    src: './public_html/css/file2.min.css',
                    dest: './public_html/css/file2.min.css',
                }
            ]
        }

Sorry. Missed the target. This is working.

assets_versioning: {
            options: {
                tag: 'hash',
                hashLength: 6,
                versionsMapFile: './apps/frontend/assets/version.json'
            },
            target: {
                files: [
                    {
                        src: './public_html/css/file1.min.css',
                        dest: './public_html/css/file1.min.css',
                    },
                    {
                        src: './public_html/css/file2.min.css',
                        dest: './public_html/css/file2.min.css',
                    }
                ]
            }
        }

ruudboon avatar Apr 13 '16 14:04 ruudboon

You definitely need to specify a target and you also need to declare files as explained in the grunt documentation: http://gruntjs.com/configuring-tasks#files Can I close this ticket?

theasta avatar Apr 30 '16 19:04 theasta

@theasta you mean that the examples in the doc are wrong?

herlon214 avatar Sep 14 '16 20:09 herlon214