Git Product home page Git Product logo

h2x's Introduction

h2x

Build Status codecov

H2X is a configurable compiler to transform HTML into JSX or another language.

It is inspired by babel and configurable using plugins.

Usage

import { transform } from 'h2x-core'
import jsx from 'h2x-plugin-jsx'

const result = transform(`<div class="foo"></div>`, { plugins: [jsx] })
console.log(result) // <div className="foo" />

Why

Transforming HTML into JSX is not simple. It's a complicated operation which requires a compiler to do properly.

Extending it with plugins will give us the ability to create awesome utilities.

License

MIT

h2x's People

Contributors

bradleyayers avatar gregberge avatar mattijsbliek avatar racingrebel avatar singingwolfboy avatar trysound avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

h2x's Issues

Upgrade JSDOM

Actually it is impossible to upgrade JSDOM because all objects are freezed. We should try to update it and not use it directly as an AST. We could modify properties in a kind of proxy.

Docs!

Hey @neoziro just started poking around in h2x. It's awesome. You guys are creating such cool stuff.

Anyway, I'd love to start building a few h2x plugins but I'm also not familiar with how the tree traversals work.

here's the first plugin I'm thinking:

given an SVG like this:

<svg width="18" height="18" viewBox="0 0 60 60" xmlns:xlink="http://www.w3.org/1999/xlink" fill="rgb(255,255,255)">
  <defs>
    <path d="M16 16h28v4H16v-4zm-6 12h40v4H10v-4zm6 12h28v4H16v-4z" id="a"></path>
  </defs>
  <use fill="#FFF" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#a" fill-rule="evenodd"></use>
</svg>

I'd like to check to see if there is only 1 reference to a<use> remove the element from defs and inline it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.