Skip to content

Instantly share code, notes, and snippets.

@bbenjamin
Created March 26, 2018 02:44
Show Gist options
  • Save bbenjamin/13a44ce70cbed9d05061713b0c118cb0 to your computer and use it in GitHub Desktop.
Save bbenjamin/13a44ce70cbed9d05061713b0c118cb0 to your computer and use it in GitHub Desktop.
Transpile Drupal Module/Theme ES6 to ES5 in PHPStorm
In PHPStorm, go to Preferences > Tools > File Watchers
Click the plus sign to add a new watcher, and choose Babel
Set "Program" to the babel-cli executable. On OSX this might be /usr/local/bin/babel.
Or, if babel-cli is installed in node_modules, you can use the version found in node_modules/.bin
Set "Arguments" to $FileDirRelativeToProjectRoot$/$FileNameWithoutAllExtensions$.es6.js --out-file $FileDirRelativeToProjectRoot$/$FileNameWithoutAllExtensions$.js
Set "Output Paths To Refresh" to
$FilePathRelativeToProjectRoot$/$FileNameWithoutAllExtensions$.es6.js:$FilePathRelativeToProjectRoot$/$FileNameWithoutAllExtensions$.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment