I see it is possible to get the contents of the js files using onBuildWrite but I am needing a way to inject values into our root html page, is this possible? EG we would like to swap out our less file for a css version.
It's possible with node.js:
var fs = require('fs');
// read html file
var fileContents = fs.readFileSync('index.html', 'utf8');
// replace rel attribute for less file with rel for css
fileContents = fileContents.replace(/stylesheet\/less/gi, 'stylesheet');
// replace file name
fileContents = fileContents.replace(/css\/application.less/gi, 'css/application.css');
// remove less runtime compiler (if needed)
fileContents = fileContents.replace(/<script.*?\bless\b[^"']*?\.js.*?<\/script>/g, '');
// write file back
fs.writeFileSync('index.html', fileContents, 'utf8');
Just add that as a part of your build script, along with calling r.js.