• Stars
    star
    430
  • Rank 100,470 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[not maintained] Seed project for React apps using ES6 & webpack.

React seed Build Status

A boilerplate for building React apps with ES6 and webpack.

This is old. You should use create-react-app instead.

What you get

  • React 0.13
  • ES6, ES7 & JSX to ES5 via babel
  • webpack with react hot loader, and other useful loaders
  • Local CSS
  • Karma, mocha, chai & sinon for testing with mocking examples
  • Basic flux architecture with app actions, stores and example web API usage
  • React router (feature/react-router)
  • Material UI (feature/material-ui)

Getting started

Installing with git

git clone --depth=1 https://github.com/badsyntax/react-seed.git my-project

Installing with yeoman

  1. npm install -g yo
  2. npm install -g generator-react-seed
  3. Use the generator like so: yo react-seed

npm scripts

  • npm start - Build and start the app in dev mode at http://localhost:8000
  • npm test - Run the tests
  • npm run build - Run a production build

Examples

###ย Writing components:

// Filename: Menu.jsx

'use strict';

import styles from './_Menu.scss';
import React from 'react';
import MenuItem from './MenuItem';

let { Component, PropTypes } = React;

export default class Menu extends Component {

  static defaultProps = {
    items: []
  };

  static propTypes = {
    items: PropTypes.array.isRequired
  };

  render() {
    return (
      <ul className={styles.menu}>
        {this.props.items.map((item) => {
          return (<MenuItem item={item} />);
        }, this)}
      </ul>
    );
  }
}

###Writing tests:

// Filename: __tests__/Menu-test.jsx

'use strict';

import React from 'react/addons';
import { expect } from 'chai';

import Menu from '../Menu.jsx';
import MenuItem from '../MenuItem.jsx';

// Here we create a mocked MenuItem component.
class MockedMenuItem extends MenuItem {
  render() {
    return (
      <li className={'mocked-menu-item'}>{this.props.item.label}</li>
    );
  }
}

// Here we set the mocked MenuItem component.
Menu.__Rewire__('MenuItem', MockedMenuItem);

describe('Menu', () => {

  let { TestUtils } = React.addons;

  let menuItems = [
    { id: 1, label: 'Option 1' },
    { id: 2, label: 'Option 2' }
  ];

  let menu = TestUtils.renderIntoDocument(
    <Menu items={menuItems} />
  );
  let menuElem = React.findDOMNode(menu);
  let items = menuElem.querySelectorAll('li');

  it('Should render the menu items', () => {
    expect(items.length).to.equal(2);
  });

  it('Should render the menu item labels', () => {
    Array.prototype.forEach.call(items, (item, i) => {
      expect(item.textContent.trim()).to.equal(menuItems[i].label);
    });
  })

  it('Should render the mocked menu item', () => {
    expect(items[0].className).to.equal('mocked-menu-item');
  });
});

Sass, CSS & webpack

import Sass and CSS files from within your JavaScript component files:

// Filename: app.jsx
import 'normalize.css/normalize.css';
import styles from './scss/app.scss';
  • Note: If you're importing component Sass files from within your JavaScript component files, then each sass file will be compiled as part of a different compile process, and thus you cannot share global references. See this issue for more information.
  • Sass include paths can be adjusted in the webpack/loaders.js file.
  • All CSS (compiled or otherwise) is run through Autoprefixer and style-loader. Any images/fonts etc referenced in the CSS will be copied to the build dir.
  • CSS files are combined in the order in which they are imported in JavaScript, thus you should always import your CSS/Sass before importing any other JavaScript files.
  • If not using local CSS, use an approach like BEM to avoid specificity issues that might exist due to unpredicatable order of CSS rules.

HTML files

All required .html files are compiled with lodash.template and synced into the ./build directory:

// Filename: app.jsx
import './index.html';
  • You can adjust the lodash template data in the webpack/loaders.js file.

Conventions

  • Use fat arrows for anonymous functions
  • Don't use var. Use let and const.

Releasing

  1. npm version patch
  2. git push --follow-tags
  3. npm login (Optional)
  4. npm publish

Credits

This project was initially forked from https://github.com/tcoopman/react-es6-browserify

License

Copyright (c) 2015 Richard Willis

MIT (http://opensource.org/licenses/MIT)

More Repositories

1

jquery-spellchecker

[not maintained] A lightweight jQuery plugin that can check the spelling of text within a form field or DOM tree.
JavaScript
259
star
2

grpc-js-typescript

Generate gRPC TypeScript definitions for use with gRPC (@grpc/grpc-js).
156
star
3

SassBeautify

[not maintained] A Sublime Text plugin that beautifies Sass files.
Python
143
star
4

jquery-youtube-player

[not maintained] A chromeless or embedded youtube video player, with custom toolbar and playlist.
JavaScript
70
star
5

docker-box

A lightweight docker application platform for single servers.
Shell
66
star
6

handlebars-form-helpers

Handlerbars.js form helpers
JavaScript
55
star
7

kohana3-examples

Example files for Kohana v3
PHP
33
star
8

react-snap-example

Example project for react-snap
JavaScript
26
star
9

mailinabox-ui

Experimental Mail-in-a-Box User Interface built with React, Redux, TypeScript & Fluent UI
TypeScript
19
star
10

dokku-discourse

Dokku plugin to manage discourse on your dokku server
Shell
16
star
11

tinymce-custom-inlinepopups

TinyMCE jQuery UI inline popups
JavaScript
16
star
12

polymer-twitter

An example twitter stream built with polymer web components
CSS
11
star
13

vscode-spotless-gradle

A VS Code extension to lint & format your source files using Spotless & Gradle.
TypeScript
11
star
14

vscode-entity-framework

Manage Entity Framework migrations in VS Code.
TypeScript
8
star
15

kohana3-admin

An example Kohana3 Admin module
PHP
8
star
16

gruntfile

An example project showing a better way to organize your gruntfile.
JavaScript
8
star
17

kohana3-base

Example Kohana 3 base module
PHP
7
star
18

strapi-webhook-actions-proxy

Strapi webhook proxy to trigger a GitHub repository_dispatch event
TypeScript
7
star
19

github-action-aws-cloudformation

GitHub Action to create/update your CloudFormation stack
TypeScript
7
star
20

kohana-device

Kohana 3.3 mobile device detection
PHP
7
star
21

richardwillis.info

My personal website
TypeScript
6
star
22

atom-sassbeautify

Beautify your Sass files
JavaScript
6
star
23

openapi-dotnet-react-typescript-fetch-example

An example project showing how to use the OpenAPI typescript-fetch HTTP client with React
Mustache
5
star
24

jquery-spellchecker-demo

Demos for the jQuery Spellchecker plugin
JavaScript
5
star
25

mailinabox-api

HTTP client SDK's for the Mail-in-a-Box API.
Mustache
5
star
26

generator-react-seed

React seed Yeoman generator
JavaScript
5
star
27

richardwillis.info-strapi

JavaScript
4
star
28

express-project-boilerplate

An express/requirejs/grunt/bower project boilerplate
JavaScript
4
star
29

domwalker.js

Find and replace text across nodes by walking the dom (work in progress)
JavaScript
4
star
30

s3-etag

Generate an accurate S3 ETAG in Node.js for any file (including multipart)
TypeScript
4
star
31

github-action-aws-s3

GitHub Action to sync files to S3. Includes accurate ETAG comparisons and parallel uploads with configurable concurrency & multipart chunk sizes
TypeScript
3
star
32

mailinabox-api-ts

JavaScript/TypeScript client SDK for the Mail-in-a-Box API.
TypeScript
3
star
33

github-action-issue-comment

Comment on a GitHub Issue using a Handlebars template.
3
star
34

github-action-aws-cloudfront

GitHub Action to easily invalidate CloudFront paths
TypeScript
3
star
35

mailinabox-api-py

Python client SDK for the Mail-in-a-Box API.
Python
3
star
36

github-action-render-template

A GitHub Action to render a Handlebars template
TypeScript
3
star
37

kohana-examples

Kohana 3.3 examples
PHP
2
star
38

dokku-setup

Simple docs on how to setup and use dokku.
Dockerfile
2
star
39

2do

2do: organize your life
PHP
2
star
40

bash-scripts

A small collection of possibly useful bash scripts
Shell
2
star
41

itunes-utils

A bash script that helps you manage your itunes library through applescript
Shell
2
star
42

github-action-aws-static-stack

A GitHub Action to deploy your static website to the AWS Edge.
CSS
2
star
43

server-tools

A repo to store documentation and BASH scripts for setting up a new Hetzner dedicated server
Shell
2
star
44

compressr.cc

Easily compress your Javascript using Closure Compiler, YUI compressor or Uglify.
PHP
2
star
45

pyrocms-tumblrimport

A PryoCMS module to import a tumblr blog.
PHP
2
star
46

sass-wrapper

[deprecated/not maininted] A nodejs module that provides a friendly javascript API for interacting with sass
JavaScript
2
star
47

playwright-test-repo

An example repo showing issues when importing an ES Module in your @playwright/test test file, and a workaround.
TypeScript
2
star
48

mp3-arrange

Arrange your music collection
JavaScript
2
star
49

angular-twitter

An example twitter stream built using angularjs
JavaScript
2
star
50

lxd-web-panel

A WIP web panel for LXD
JavaScript
1
star
51

dotfiles

A repo to store my dotfiles.
Vim Script
1
star
52

react-twitter

An example twitter stream built with react, es6, browserify and other shiny tools
JavaScript
1
star
53

vscode-generator-eslint-prettier-example

vscode-generator-eslint-prettier-example
TypeScript
1
star
54

dokku-email

A simple dokku plugin to send email notifications on successful deployment.
Shell
1
star
55

badsyntax.github.com

My github area
PHP
1
star
56

badsyntax.co

My Node.js site
JavaScript
1
star
57

jquery-snakey

jQuery snaky - a nibbles clone
JavaScript
1
star
58

jquery-plugins

A small collection of jQuery plugins / widgets
JavaScript
1
star
59

assetmanager

A kohana 3 assetmanager module, used in my admin module.
PHP
1
star
60

hyperapp-starter-project

Hyperapp starter project
JavaScript
1
star
61

docker

A repo to store my base docker images
Dockerfile
1
star
62

kohana-installer

Command line installer for Kohana using Github sources
Shell
1
star
63

dokku-github-actions-demo

HTML
1
star
64

ExampleRNScreenIssue

TypeScript
1
star
65

richard-willis-vscode-extension-pack

VS Code Extension pack for Richard Willis
1
star