Move ES2015 example into a subpage of the NodeServicesExamples sample

This commit is contained in:
SteveSandersonMS
2016-06-07 14:31:23 +01:00
parent facc2c6d08
commit 8dbd143857
5 changed files with 33 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
var fs = require('fs');
var babelCore = require('babel-core');
module.exports = function(cb, physicalPath, requestPath) {
var originalContents = fs.readFileSync(physicalPath);
var result = babelCore.transform(originalContents, {
presets: ['es2015'],
sourceMaps: 'inline',
sourceFileName: '/sourcemapped' + requestPath
});
cb(null, result.code);
}