npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsxtache

v0.0.14

Published

jsxtache >> jsx + mustache

Downloads

8

Readme

#EXPERIMENTAL! DON'T USE!

###jsxtache

Write React components with Mustache. Generate a Mustache version (for server) + JSX version (for client). For use when JS on server is not possible, but Mustache is.

npm install -g jsxtache

######Why?

Because React is awesome. But JS on the server is a tough argument. This dumbs down React to Mustache's level, so that it can cross-compile into both.

######Can I take advantage of React's smart server side rendering?

Not yet. Working on it.

######Info...

  • Separates JS + template. Combined by convention.
  • Mustache-like syntax.
  • {{* *}} special signifier for 'JSXtache'.
  • YAML-like, white space significant attributes.
  • Handles partials + passes down {...this.props} and {...this.state}

######Syntax

JSX (.jsx)

var React = require('react');
module.exports = React.createClass({
  render: function() {
    return;
  },
  _onClick: function() {
    // do something
  },
  _onHover: function() {
    // do something
  }
});

Matching JSXtache (.jsx.mustache)

<div {{*
  id: this.props.element_id
  class:
    "class-a": true
    "class-b": this.props.b_show_class_b
    "not-class-b": !this.props.b_show_class_b
    this.props.class_c: this.props_b_show_class_c
    "class-" this.props.class_d: this.props.b_show_class_d
    "class-e class-f class-g": true
  data-something: "something" + this.props.something + "-something"
  onClick: this._onClick
*}}>
  {{> partials/partial_a}}
  {{#this.props.arr}}
    <div {{*
      key: scoped_val_OR_true
    *}}>
      <div {{*
        id: element_id
        class: "arr-element"  
      *}}>
        <p>{{title}}</p>
        {{> partials/partial_b}}
      </div>
    </div>
  {{/this.props.arr}}
  {{^this.props.arr}}
    <span {{*
      onDoubleClick: this._onDoubleClick
    *}}>Nothing in Arr</span>
  {{/this.props.arr}}
  <span {{*
    onClick: this._onClick
  *}}>
    {{this.props.something}}
  </span>
</div>

######Project Structure

There are a few options for coordinating JSX / JSXtache. JSXtache syntax can be used, or this can manage duplication between mustache + JSX.

Manage Duplication:

  • .jsx file; render + mustache method; inline jsx + mustache
  • .jsx file + .mustache file; inline jsx; mustache by convention

JSXtache syntax:

  • .jsx file -- render method -- inline jsxtache
  • .jsx file + .jsx.mustache file; jsxtache by convention

Example

components/
components/component.jsx
components/component.jsx.mustache
components/partials/
components/partials/one.jsx
components/partials/one.mustache
components/partials/two.jsx

######CLI

Cross-compiles the strcuture from above into specified mustache / JSX / JS directories.

jsxtache <jsxtache dir> <options...>
  --mustache (Default: null)
  --jsx (Default: null)
  --js (Default: null)
  --mustache-out-ext (Default: .mustache)
  --jsx-out-ext (Default: .jsx)
  --js-out-ext (Default: .js)
  --mustache-filename-append (Default: "")
  --jsx-filename-append (Default: "")
  --js-filename-append (Default: "")
jsxtache help
jsxtache version

Example

jsxtache app/components --mustache app/mustache --js app/js