grunt-dom-munger
grunt-dom-munger copied to clipboard
Extend for a Source Map onto the writeto variable
Adds a source map of retrieved values according to the processed source, to make use of a source arrays. Extends to {writeto}SrcMap
. Fixes #32
Example
grunt.initConfig({
dom_munger: {
your_target: {
options: {
read: {
selector: 'script',
attribute: 'src',
// ->
writeto: 'jsRefs',
// <-
isPath: true
}
},
// Going through multiple html files, collecting javascript references
src: ['html/*.html']
},
},
log: {}
});
Array of last processed document (jsRefs):
grunt.config.process(<%= dom_munger.data.jsRefs %>)
[ 'html/assets/javascript5.js',
'html/assets/javascript6.js' ]
Object source map with arrays of last processed document (jsRefsSrcMap):
grunt.config.process(<%= dom_munger.data.jsRefsSrcMap %>)
{ 'html/first.html':
[ 'html/assets/javascript1.js',
'html/assets/javascript2.js' ],
'html/second.html':
[ 'html/assets/javascript3.js',
'html/assets/javascript4.js' ],
'html/third.html':
[ 'html/assets/javascript5.js',
'html/assets/javascript6.js' ]
}