0.1.0 • Published 7 years ago

hsx v0.1.0

Weekly downloads
10
License
MIT
Repository
github
Last release
7 years ago

hsx

hsx Stability Index hsx on NPM Standard JavaScript Style

Static HTML sites with JSX, Sass, and webpack (no React).

About

  • Meant for building static websites (not apps)
  • Compiles JSX to HTML, without React (JSX becomes an HTML templating language)
  • Supports simple, presentational Components (similar to React's functional stateless components)

Why?

  • JSX is an incredibly powerful HTML templating language
  • "HTML in JS" feels awesome
  • webpack is insanely powerful
  • Building static sites with a module bundler (webpack) offers distinct advantages over gulp/grunt

What's in the Box

hsx is a CLI for scaffolding a new project (see the template). A brief description of what's inside follows:

Install

$ npm i hsx -g

Use

To create a new project:

# using node and npm
# install hsx globally
$ npm install hsx -g

# use the hsx command from the CLI to scaffold a project
# template files are copied to the CWD, unless a path is specified
$ hsx [path]
$ npm i
$ npm run dev

Then, in your browser: http://localhost:3000/

First Component

Note the cue to babel to transform JSX into sd function calls, instead of React.createElement.

import sd from 'string-dom'

/** @jsx sd */

// create a simple Div component
// children is the HTML wrapped by the element
const Div = ({ children, name }) => (
  <div class={ name }>
    { children }
  </div>
)

// render it to the DOM, with some inner content
document.body.innerHTML += (
  <Div name="site">
    <h1>hsx</h1>
    <p>This is inside the Div component!</p>
  </Div>
)

License

MIT. © 2017 Michael Cavalea

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago