grunt-dom-munger icon indicating copy to clipboard operation
grunt-dom-munger copied to clipboard

Array src - writeto variable overwritten

Open D1no opened this issue 9 years ago • 0 comments

I want to collect all the javascript file references (paths) from all html files [src].

Is there a way to achieve this? Currently, the writeto variable jsRefs is getting overwritten and I am not sure how to get around this.

grunt.initConfig({
        dom_munger: {
            your_target: {
                options: {
                    read: {
                        selector: 'script',
                        attribute: 'src',
                        // Is there a way to instruct jsRefs to be
                        // a multi-dimensional array or object.key
                        // combination per source file holding
                        // the jsRefs Arrays?
                        writeto: 'jsRefs',
                        // <-
                        isPath: true
                    }
                },
                // Going through multiple html files, collecting javascript references
                src: ['html/*.html']
            },
        },
        log: {}
    });

    grunt.registerTask("log", function() {
        var jsFiles = grunt.config.process('<%= dom_munger.data.jsRefs %>');

        // only last processed file with array of paths
        console.dir(jsFiles);
    });

D1no avatar May 14 '15 01:05 D1no