Coder Social home page Coder Social logo

react-microsite's Introduction

react-microsite

A react router microsite with json data navigation / content setup and sass + bulma framework.

package.json contents:

  • Javascript libraries / build: React 16.4.2, React DOM 16.4.2, React Router 4.3.1, Axios, Babel , d3.js and react-anime
  • Stylesheet/ preprocessors / frameworks: sass & bulma (flexbox framework)

Running the build


Assuming that your local dev environment has node.js / nvm, webpack and yarn installed please proceed through the steps below:

  1. Clone/ Download the project folder into your local environment
  2. Run "yarn install" to download the packages as written on the package.json.
  3. Run "npm run build" on the command line to build the project.
  4. Run "npm run dev" to get the localhost server up and running.

Setting file paths for React Router & Axios


  • I have found file paths to be an issue with React Router and Axios when deploying this in a subdirectory of a server and made a file which consist of configuration settings called "axiosOptions.jsx" located in "./src" folder.
  • Changing the basePath variable to be the same as the webpack.config.js "PUBLIC_PATH" should fix file path issues.

Packaging


  1. Make sure the file paths are set correctly before deploying i.e if the hosting url of this microsite is http://hostname.com/subdirectory then the webpack.prod.js PUBLIC_PATH value should be "/subdirectory" along with the basePath = "/subdirectory" in axiosOption.jsx
  2. Run the command "npm run prod" should minify the build into the "prod" folder with the correct filepath settings.

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.