Sunday, 9 April 2017

using gulp-theo in nodejs to convert yaml to xml file

I have my app.js as of below,

app.get('/downloadXML',function(req,res){

const theo = require('theo')

theo.convert({
transform: {
type: 'android',
file: 'tokens.yml'
},
format: {
type: 'android.xml'
}
})
.then(result => {
console.log(result);
fs.writeFile('convertJSON.xml',result,function(err,item){
   if(err){
   }
  });
})
.catch(error => console.log(`Something went wrong: ${error}`))
 });

So here am trying to convert Yaml file to XML file. but its not happening. convertJson.xml file have added but it has no content inside it except xml notations.

same thing worked for json but not for xml. please help me in converting yml file to xml. here is my yaml file,

color :
 white : &color-white "#FFFFFF"
 black : &color-black "#262626"
neutral :
 20 : &color-neutral-20 "#222222"
 90 : &color-neutral-90 "#EEEEEE"
blue:
 50: &color-blue-50 "#0000ff"
 90: &color-blue-60 "#3333ff"



via swaroop sg

No comments:

Post a Comment