Created
September 18, 2016 18:40
-
-
Save a-laughlin/099cd230bd38c6ecf76fd9fa6b8aedcd to your computer and use it in GitHub Desktop.
install babel and transpile a directory of files appropriate for your specified environment (e.g., node 6, ie9+ browsers)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function instababel(){ | |
outputEnv=$1 | |
destDir=$2 | |
srcDir=$3 | |
if [[ ! $3 ]]; then | |
echo "Must call as $ instababel <outputEnv> <srcDir> <destDir>" | |
echo "outputEnv options are node6 & ie9+" | |
return; | |
fi | |
if [[ $outputEnv = 'node6' ]]; then | |
rm -rf $destDir | |
npm i babel-cli babel-preset-stage-2 babel-preset-node6 babel-plugin-transform-runtime | |
./node_modules/.bin/babel $srcDir --out-dir $destDir --presets babel-preset-node6,stage-2 --plugins transform-runtime --compact false --no-babelrc | |
return | |
fi | |
# if [[ $outputEnv = 'ie9+' ]]; then | |
# return | |
# don't need this right now. Can make it later. | |
# fi | |
echo No babel config for $outputEnv yet. Make one! | |
} | |
export -f instababel; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment