var replace = require("replace"); var path = require('path') var apiPath = path.join(__dirname, '..', 'docs', 'api'); var replacements = [ {find: /\/docs\/guides\/(.+)\.md/g, replace: 'tutorial-$1.html'}, {find: /tutorial-tech.html/g, replace: 'tutorial-tech_.html'}, {find: /\/docs\/guides\//g, replace: '#'}, {find: /(\/g, replace: '$1videojs$2">'}, {find: /(\/g, replace: '$1dont$2">'}, {find: /(\/g, replace: '$1nodejs$2">'}, {find: /(\/g, replace: '$1vttjs$2">'}, {find: /(\)/g, replace: '$1$2$3'}, {find: /(\)/g, replace: '$1$2$3'}, {find: /(\)/g, replace: '$1$2'}, // replace all children with children-1 {find: /\

/g, replace: '

'}, // remove the -1 from the first item {find: /\

/, replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'}, {find: '

', replace: '

'} ]; replacements.forEach(function(obj) { replace({ regex: obj.find, replacement: obj.replace, paths: [apiPath], recursive: true, silent: true }); });