Run Babel on inline Alpine.js directive code.
alpine-inline-babel is a PostHTML plugin.
You can install it as follows (ignore posthtml & @babel-* if they're already installed).
npm install --save-dev alpine-inline-babel @babel/core @babel/preset-env posthtml
# or
yarn add --dev alpine-inline-babel  @babel/core @babel/preset-env posthtmlconst posthtml = require('posthtml');
const inline = require('alpine-inline-babel');
// `targets` is babel-preset-env targets,
// see https://babeljs.io/docs/en/babel-preset-env#targets
posthtml([inline({targets: {ie: '11'}})])
  .process(
    `<div x-data="{ show: false }">
  <button @click="show = !show">
    Toggle
  </button>
  <div x-show="show">
    Can be toggled
  </div>
</div>`
  )
  .then(({html}) => {
    // Do something with the HTML
    console.log(html);
  });- Node 10
 - Yarn 1.x or npm
 
- Clone the repository
 - Run 
yarnornpm installinstalls all required dependencies. 
Equivalent
npm run <script>should also work
yarn testwill run tests with uvuyarn lintwill lint all of the files with xoyarn fmtwill run lint with--fixoption on all the examples files (and tests).
Code is licensed under the MIT License.