Git Product home page Git Product logo

react-starter's Introduction

React boilerplate

Fast builder for your SPA projects.

React starter pack

Easily configure and add webpack modules and style your app without any stress with styled-components

Navigation

Installation

  1. Clone the branch you need

  2. cd to react-starter folder.

  3. Install webpack dependencies via npm npm i or yarn yarn install.

  4. Start your web server yarn start || npm run start.

Concept

All your webpack modules are in webpack folder. You can easily call the module you need in webpack.config.js file.

const rules = [babel(), images(), fonts(), anyOtherModule()];

const common = merge([
  {
    // ...
    module: {
      rules,
    },
  }
]);

There are 2 modes you can work with: production and development which are declared in package.json file.

According to version 4 of styled-components, global styles are now declared through the createGlobalStyle and imported into the top component of the application. Check our src/layout/ folder.

File location

.
├── src/                    # App folder with all developer stuff
│   ├── components/         # All components used in the project
│   ├── layout/             # Laout the entire app is stored in one place
│   ├── pages/              # Pages that use components/
│   ├── static/             # Used to store fonts, icons, images
│   └── ...
├── webpack/                # Modules you can easily add to config
├── webpack.config.js       # All webpack settings
└── ...

Build production

To build a production version of your app you need to type

npm run build || yarn build

This will create dist folder where everything will be compressed and minified.

Aliases

If you need to configure your custom aliases you don't need .env file or something like eslint-import-resolver-babel-root-import. All you need is set aliases in webpack.config.js file.

// webpack.config.js
const common = merge([
  {
    entry: {
      index: './src/index.js',
    },
    // ...
    resolve: {
      extensions: ['.js', '.jsx'],
      modules: ['node_modules'],
      alias: {
        src: path.resolve(__dirname, 'src'),
      },
    },
  }
]);

/*
  src
  |- pages
    |- MyComponent
      |- index.js
  |- actions
    | index.js
*/


import actionName from 'src/actions';

const MyComponent = () => ();

Used plugins

The idea behind the example

Show one of the possible webpack configurations

Also remind me stuff :D

react-starter's People

Contributors

alexlms avatar

Stargazers

 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.