GithubHelp home page GithubHelp logo

react_generator's Introduction

React Component Generator

An Accio generator that creates a skeleton of a React component using CommonJS imports.

Setting Up

Installation

npm install accio npm install react_generator

Configuration

Example of an accio.config.js that will allow calling the react_generator:

module.exports = {
  aliases: {
    rc: 'react_component'
  },
  generators: {
    react_component: {
      path: '/node_modules/react_generator/react_component.js',
      output: function(name) {
        return ('/src/components/' + name + '.js.jsx');
      },
    }
  }
};

This will allow calling the generator under the name 'react_component' or 'rc' with Accio and will generate component skeletons in the directory 'src/components/' with the extension '.js.jsx'.

Usage

Within the root of your project directory, you should be able to run the either of the following commands to generate a 'to_do_list' component skeleton:

> accio react_component to_do_list

or

> accio rc to_do_list

What it does

The generator will use the command line argument as the name of the generated file, and it will create a component using the camel-cased version of the filename. Given the argument 'to_do_list', it will output the following code into the generated file:

var React = require('react/react');

var ToDoList = React.createClass({
  /**
   * @return {Object}
   */
  render: function() {
    return (
      <p>ToDoList CONTENT HERE</p>
    );
  }
});

module.exports = ToDoList;

Generating multiple components

You may pass multiple component names at the same time:

> accio rc to_do_list to_do_item to_do_form to_do_app

This will generate four separate component skeletons.

react_generator's People

Contributors

flarnie avatar

Stargazers

 avatar

Watchers

 avatar  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.