Giter Club home page Giter Club logo

optimus-jsx's Introduction

optimus-jsx Build Status

A React JSX asset loader for Optimus.

Install

  • Add [optimus-jsx "0.1.1"] to :dependencies in your project.clj.
  • It requires Optimus version minimum 0.13.6.

Usage

Add (:require optimus-jsx.core) to the namespace declaration where you're loading assets.

The load-jsx-asset function will be declared as a custom loader for .jsx files with Optimus' load-asset multimethod. This is in turn used by load-assets, load-bundle and load-bundles - so everything works like before, but now it also supports JSX files.

Bundling

The .jsx files are immediately transpiled into .js files. This means you can safely bundle JS and JSX files together. It also means that the bundle identifier has to be .js. Like so:

(assets/load-bundle "public"
                    "app.js"
                    ["/script/lib.js"
                     "/script/code.jsx"])

Contribute

Yes, please do.

If you're looking to add other transpilers, I think that would be best in a separate project. But please do let me know about it, so I can link to it in the Optimus README. :-)

Remember to add tests for your feature or fix, or I'll certainly break it later.

Installing dependencies

You need npm installed to fetch the JavaScript dependencies. The actual fetching is automated however.

Running the tests

lein midje will run all tests.

lein midje :autotest will run all the tests indefinitely. It sets up a watcher on the code files. If they change, only the relevant tests will be run again.

License

Copyright © 2014 Magnar Sveen

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

optimus-jsx's People

Contributors

magnars avatar

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.