I am new to grunt. I'm trying to figure out how to read an .xml
file from a grunt task. Ideally, I'd like to load the xml into JSON. However, I can't figure out how to even read an .xml
file from a grunt task. Does anyone have an example of how to do this?
Thank you!
If you want something that doesn't require python or a c compiler, and is synchronous, try node-xml-lite:
var parseXML = require('node-xml-lite').parseString;
var webConfigDoc = parseXML(grunt.file.read('../web.config'));
The parsed document object can be a little tricky to work with, but underscore find* methods can help.
README
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With