MIT License

项目介绍

unimonkiez/react-cordova-boilerplate 是一个托管在 GitHub 上的开源项目,主要使用 JavaScript 编写,采用 MIT License 许可证,目前获得 209 个 Star、55 次 Fork。

仓库全名
unimonkiez/react-cordova-boilerplate
开源许可证
MIT License
Star 数
209
Fork 数
55
未关闭 Issue
2

README 摘要

React Cordova boilerplate Demo - click the image to try it Why cordova and React 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 react project, and can be used to maintain a website and mobile application from same source code (and maybe transitioning later to react-native). I highly advise to check out my…

完整内容见 GitHub 原始 README 或本页 。

常见问题

react-cordova-boilerplate 用什么语言开发?

主要使用 JavaScript 编写,采用 MIT License 许可证,目前有 209 个 Star。

react-cordova-boilerplate 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 react-cordova-boilerplate 的源码?

可以直接克隆仓库:git clone https://github.com/unimonkiez/react-cordova-boilerplate.git,默认分支为 master;安装与运行步骤见仓库 README。

react-cordova-boilerplate 最近还在维护吗?

仓库最近一次更新为 2018年2月18日,当前有 2 个未关闭 Issue;Star 数为 209,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

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

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
332
价值分
143
活跃状态
活跃

语言占比

CSS
HTML
JavaScript
Shell

Release

README

Build Status Dependency Status devDependency Status npm version

React Cordova boilerplate

Demo - click the image to try it

Why cordova and React

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 react project, and can be used to maintain a website and mobile application from same source code (and maybe transitioning later to react-native).
I highly advise to check out my other boilerplate, which is similar in many ways but produces a native app.

Features

  • eslint
  • Smart build using Webpack 2
    • ES6
    • React (jsx)
    • Server rendering for initial page
    • Style: Radium + SASS
  • React router
  • Testing
    • Mocha
    • jsdom (blazing fast testing on nodeJs)
    • Sinon
    • Chai
    • Coverage using nyc

Installing

  1. Install dependencies: npm i or yarn install
  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[:report] - runs linting against src folder and fix some of the issues, report option to generate html report to ./report.html.
  • npm run start[:prod] - starts a server, with react model replacement and devtools on localhost:8080, prod option to minify the build (same build eventually integrated with the cordova app).
  • npm run build[:prod][:watch] - builds the project (single html file and single js file) as it does for development.
  • npm run test[:watch][:coverage] - runs Mocha testing, outputs result to console, watch options to watch files and test again after file modification, coverage option to generate coverage reports to ./coverage folder (index.html is a usuful one!).

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.

Troubleshooting

  • Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js X.x If you get an error like this means you previously installed Node SASS in an older version of Node which no longer applies to you. To fix run npm rebuild node-sass

评论

暂无评论