Skip to content

Instantly share code, notes, and snippets.

@HendrikRoth
Created February 25, 2016 20:50
Show Gist options
  • Save HendrikRoth/a81675480b9439e644d2 to your computer and use it in GitHub Desktop.
Save HendrikRoth/a81675480b9439e644d2 to your computer and use it in GitHub Desktop.
'use strict';
const watch = require('transpile-watch');
watch({
persistent: !(process.argv[2] === 'once'),
what: process.argv[3],
ignore: (process.argv[4] && process.argv[4] !== 'null') ? process.argv[4] : null,
extension: '.es6',
createOutPath: (inPath) => {
return inPath.replace(/.es6$/, '.js');
},
transform: (inPath, outPath) => {
const sourceMapPath = `${inPath}.map`;
return [
`babel --source-maps --presets es2015 --plugins add-module-exports,mjsx ${inPath} |`,
`exorcist ${sourceMapPath} > ${outPath} ;`,
`mithril-objectify ${outPath} ${outPath} ;`,
`uglifyjs -p relative --source-map-root / --in-source-map ${sourceMapPath} --source-map ${sourceMapPath} --screw-ie8 -c -m sort -r \'require,exports\' -o ${outPath} ${outPath}`
].join(' ');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment