参考demo 项目 https://github.com/rongfengliang/fusionjs-docker-demo

安装

  • create startkit
yarn global add create-fusion-app

创建基本项目

  • 使用create
yarn create fusion-app appdemo
  • 运行(开发模式)
yarn dev
  • 效果
  • 运行(生产模式)
    服务器端渲染的代码

构建(生产)

  • 构建
yarn build --production

脚手架代码说明

  • main.js
插件注册
// @flow
import App from 'fusion-react';
import Router from 'fusion-plugin-react-router';
import Styletron from 'fusion-plugin-styletron-react';
import root from './root.js';
export default () => {
const app = new App(root);
app.register(Styletron);
app.register(Router);
return app;
};
  • root.js
react app 拼装

// @flow
import React from 'react';
import {Route, Switch} from 'fusion-plugin-react-router';
import Home from './pages/home.js';
import PageNotFound from './pages/pageNotFound.js';
const root = (
<Switch>
<Route exact path="/" component={Home} />
<Route component={PageNotFound} />
</Switch>
);
export default root;
  • home 组件
集成 styletron
// @flow
import React from 'react'; import {styled} from 'fusion-plugin-styletron-react'; const Center = styled('div', {
fontFamily: 'HelveticaNeue-Light, Arial',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100%',
});
const FusionStyle = styled('div', {
fontSize: '80px',
color: 'rgba(0,0,0,.8)',
paddingRight: '30px',
display: 'flex',
});
const FullHeightDiv = styled('div', {
height: '100%',
backgroundColor: '#FFFFFF',
});
const Circle = styled('div', {
height: '180px',
width: '180px',
marginTop: '20px',
backgroundColor: 'white',
':hover': {backgroundColor: '#f0f8fa'},
border: '10px solid #4db5d9',
borderRadius: '50%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}); const GettingStartedLink = styled('a', {
textDecoration: 'none',
color: '#4db5d9',
fontSize: '18px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
height: '100%',
}); const Home = () => (
<FullHeightDiv>
<style>
{`
html,body,#root{height:100%;}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);}
body{margin:0;}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}
input::-webkit-inner-spin-button,input::-webkit-outer-spin-button,input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;}
`}
</style>
<Center>
<FusionStyle>Fusion.js</FusionStyle> <Center>
<Circle>
<GettingStartedLink href="https://fusionjs.com/docs/getting-started">
Let&apos;s Get Started
</GettingStartedLink>
</Circle>
</Center>
</Center>
</FullHeightDiv>
);
export default Home;

说明

类似的框架有gastby  nextjs  nuxtjs ,从目前看来fusionjs 功能设计挺不错的,而且官方的文档也挺丰富

参考资料

https://github.com/rtsao/styletron
https://fusionjs.com/docs/getting-started/run-your-project
https://github.com/rongfengliang/fusionjs-docker-demo

 
 
 
 

fusionjs 学习一 基本试用的更多相关文章

  1. space-cloud 学习一 基本试用

    space-cloud 是一个支持多数据库,以下是一个简单的基于官方文档的试用 使用docker-compose 运行 环境准备 下载docker-compose文件 wget https://raw ...

  2. EasyARM i.mx28学习笔记——开箱试用总结

    0 前言     本月初(2014年8月)购买了周立功的EasyARM开发板,主控为EasyARM i.mx287.出于下面几个理由购买了该开发板.     [1]主要原因,有人约我一起学习一起使用该 ...

  3. fusionjs 学习二 核心概念

    核心概念 middleware 类似express 的中间件模型(实际上是构建在koa中间件模型上的),但是和koa 的中间件有差异 fusionjs 的中间件同时可以运行在浏览器页面加载的时候 se ...

  4. restql 学习一 安装试用

    restql 提供了manager 可以方便配置restql 的资源,同时也提供了一个docker-compose 运行环境 以下是一个安装使用 环境准备 docker-compose 文件   ve ...

  5. Mongodb初学习--安装、试用

    MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可扩展的高性能数据存储解决方案. 在MongoDB中数据被分组存储在数据集中,被称为一个集合(Collection ...

  6. QLoo graphql engine 学习二 基本试用(kubernetes)

    已经测试过docker&& docker-compose 的运行模式,下面测试下kubernetes的运行模式 kubernetes 我使用docker for mac qloo 安装 ...

  7. QLoo graphql engine 学习一 基本试用(docker&&docker-compose)

      说明:使用docker-compose 进行安装 代码框架 使用命令行工具创建 qlooctl install docker qloo-docker 运行qloo&&gloo 启动 ...

  8. ambassador 学习一基本试用

    安装使用docker for mac Without RBAC 安装ambassador 安装 kubectl apply -f https://getambassador.io/yaml/ambas ...

  9. deno学习一 安装试用&&几个问题解决

      基本的依赖可以参考github 我的环境是centos 7 基本安装 需要golang 以及yarn安装 Protobuf 3 这是官方的方式,实际可以变通下 cd ~ wget https:// ...

随机推荐

  1. supervisor安装及其配置

    一.supervisor概述 supervisor是一个c/s系统,被用来在类Unix系统中监控进程状态.supervisor使用python开发. 服务端进程为supervisord,主要负责启动自 ...

  2. oracle中 start with .. connect by prior.. 用法简介

    我们经常会将一个比较复杂的目录树存储到一个表中.或者将一些部门存储到一个表中,而这些部门互相有隶属关系.这个时候你就会用到connect by prior start with.oracle 提供了s ...

  3. mongodb的分片

    分片是把大型数据集合进行分区成更小的可管理的片的过程. 副本集的每一个成员(仲裁节点除外)都一份数据的完整拷贝! 分片的目的:在节省硬件成本的基础上,提高系统的整体性能.但是却增加了管理和性能的开销. ...

  4. Apache HttpClient4使用教程

    基于HttpClient 4.5.2 执行GET请求 CloseableHttpClient httpClient = HttpClients.custom() .build(); Closeable ...

  5. Python3.6(windows系统)通过pip安装bs4

    Python3.6(windows系统)通过pip安装bs4 cmd安装命令: pip install beautifulsoup4 执行结果:

  6. Vim 操作命令不完全汇总

    .命令:"重复上次修改": x命令:删除光标下的字符: u命令:撤销上次修改: dd命令:删除整行: >G命令:增加从当前行到文档末尾处的层级缩进: $命令:把光标移至行尾: ...

  7. Java多线程,线程交替执行

    两个线程,一个打印1-100的奇数,一个打印1-100的偶数:要求:线程1打印5个之后,线程2开始打印,线程2打印5个之后,线程1再开始打印,以此循环. Code: package com.qhong ...

  8. 从0开始配置ubuntu深度学习系统

    目录 个性化配置 ubuntu安装及其分区 NVIDIA驱动安装 配置使用清华源 安装shadowsocks-qt 安装chrome 安装gdebi 安装atom 安装wps 安装sogou piny ...

  9. shell 判断字符串长度是否不为0

    test.sh #!/bin/bash s1="" if test $s1 ;then echo "length is not zero" else echo ...

  10. Android 引用资源

    比如在 strings.xml 中找到的 Hello world!字符串,我们有两种方式可以引用它: 1. 在代码中通过 R.string.hello_world 可以获得该字符串的引用: 2. 在 ...