stitchfix / pyxley

Python helpers for building dashboards using Flask and React
MIT License
2.27k stars 257 forks source link

Webpack #31

Closed nmkridler closed 8 years ago

nmkridler commented 8 years ago

Pyxley 0.0.8

Changes:

utils module

PyReact dependency has been removed because it is no longer being maintained. Instead, I've added npm and webpack modules. These modules are simple wrappers for npm install and webpack.

A command line utility has been created to simplify starting a new project. In your project folder, simply type

pyxapp --init .

to create a package.json file and automatically call npm install.

Webpack handles the transpilation and bundling. The user provides the file to transpile and where the output should live.

# Create a webpack file and bundle our javascript
from pyxley.utils import Webpack
wp = Webpack(".")
wp.create_webpack_config(
    "layout.js",
    "./demo/static/",
    "bundle",
    "./demo/static/"
)
wp.run()

JSX transformation no longer occurs in ui.render_layout.

ReactRouter

Addition of the ReactRouter class. Simple template for pulling together multiple pages.
Simple example below:

    _apps = {
        "Main": {
            "route": "/",
            "filename": "layout.js"
        }
    }
    ReactRouter(_apps, "component_id", static_path=static_+"/index.js")

Updates to examples.

  1. Removal of bower dependency. All dependencies are handled by webpack.
  2. Inclusion of a webpack build component.
  3. Different process for launching apps. Launch from top level directory instead of within the project folder.
  4. Created a Plot.ly example. Simple example of including a Plot.ly chart.