Giter Site home page Giter Site logo

buzcajun / react-cordova-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from unimonkiez/react-cordova-boilerplate

0.0 2.0 0.0 120 KB

TodoMVC example for react with development tools to build a cordova application

License: MIT License

Shell 0.26% JavaScript 78.04% HTML 0.52% CSS 21.18%

react-cordova-boilerplate's Introduction

Build Status Dependency Status devDependency Status npm version

Redux DevTools TodoMVC example

Why cordova

Cordova is really simple to build cross platform mobile applications for any of your needs, this boilerplate provides a great starting point for your next project, as it uses:

  • Cordova
  • ES6
  • React
  • React router
  • Webpack
  • Server rendering
  • Karma
  • Eslint
  • Style: Redium + SASS

Installing

  1. Install dependencies: npm i
  2. Install global tools: npm install -g cordova
  3. Add your cordova platform by running cordova platform add %PLATFORM% (android and more)

Usage

  • npm run lint - runs linting against src folder.
  • npm run test - runs karma + jasmine testing.
  • npm run start - starts a server, with react model replacement and devtools.
  • npm run start:prod - starts a server, with react model replacement and minifications of main html file and js file.
  • npm run build - builds the project (single html file and single js file) as it does for development.
  • npm run build:prod - builds the project (single html file and single js file) as it does for production.

Build and run as application

As you do with any cordova application, cordova build android, cordova run android and more.

cordova runs npm run build:prod before any cordova command (using hooks).

Style practice

To style your html, simply inline style your DOM (here is why).

You can use Radium (which is included) to easily add 'css like' event listeners to your components (like hover).

Sass/CSS is included to complete some of the missing features or already written style you want to use. To use Sass/CSS simply import that file!

custom-font.scss

@font-face {
	font-family: 'custom-font';
	src:url('./custom-font.eot') format('embedded-opentype'),
		url('./custom-font.ttf') format('truetype'),
		url('./custom-font.woff') format('woff'),
		url('./custom-font.svg') format('svg');
	font-weight: normal;
	font-style: normal;
}
.customFont {
  font-family: 'custom-font';  
  &.customFontIcon {
    content: "\e600";
    &:hover {
      color: blue;
    }
  }
}

ExampleComponent.jsx

import React, { Component } from 'react';
import customFont from './custom-font.scss'

export default class ExampleComponent extends Component {
  render() {
    return (
      <div style={{backgroundColor: 'red'}}>
        Hello world!
        <span className={customFont.customFont + ' ' + customFont.customFontIcon}></span>
      </div>
      );
  }
}

Advantages:

  • Complete styling ability to go with inline style.
  • Easily use third party styles.
  • No globals - import style files and use the class (minifies signature - example .a instead of .customFont)

Sass style will be minified, bundled and included to the server rendered file.

react-cordova-boilerplate's People

Contributors

unimonkiez avatar

Watchers

James Cloos 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.