[TypeStyle] Add type safety to CSS using TypeStyle
TypeStyle is the only current CSS in JS solution that is designed with TypeSafety and TypeScript developer ergonomics in mind.
In this lesson we will show how easy it is to setup with zero configuration and also demonstrate its UI framework agnostic nature. We will also show how to integrate it with your application framework of choice using ReactJS as an example.
Install:
npm install --save typestyle
Using:
import { style } from 'typestyle';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
const className = style({
color: 'red',
background: 'yellow'
});
ReactDOM.render(
<div className={className}>
Hello Typestyle
</div>,
document.getElementById('root')
);
It generate unqiue class name:
.fdulqt6 {
background: yellow;
color: red;
}
<div data-reactroot="" class="fdulqt6">Hello Typestyle</div>
[TypeStyle] Add type safety to CSS using TypeStyle的更多相关文章
- 解决Type safety: The expression of type List needs
解决Type safety: The expression of type List needs unchecked conversion to conform to 在方法前加上这句话就可以了@Su ...
- [TypeScript] Increase TypeScript's type safety with noImplicitAny
TypeScript tries to infer as much about your code as it can. But sometimes there really is not enoug ...
- [TypeStyle] Add responsive styles using TypeStyle Media Queries
Media queries are very important for designs that you want to work on both mobile and desktop browse ...
- [TypeStyle] Load raw CSS in TypeStyle
TypeStyle tries to be an all in one CSS in JS management solution so you can always fall back to raw ...
- 给 input 中 type="text" 设置CSS样式
input[type="text"], input[type="password"] { border: 1px solid #ccc; paddi ...
- Type Safety and Type Inference
Swift is a type-safe language. A type safe language encourages you to be clear about the types of va ...
- CSS:给 input 中 type="text" 设置CSS样式
input[type="text"], input[type="password"] { border: 1px solid #ccc; paddi ...
- java中的类型安全问题-Type safety: Unchecked cast from Object to ...
首先,java语言室类型安全的,通常我们遇到这个问题是出现在Object转化为目标类型时, 这个转化并不是安全的.这个问题普遍认为因为使用了jdk1.5或者1.6的泛型, request.getAtt ...
- Type safety: Unchecked cast from Object to ArrayList
表明Object转化为ArrayList这个转化并不是安全的.. 编译的时候需要加入修饰符才能正常编译(具体是那个修饰符..不记得了.^_^),否则会提示有警告 当然这只是一个警告,如果楼主自信这个转 ...
随机推荐
- 洛谷 P1405 苦恼的小明
P1405 苦恼的小明 题目描述 黄小明和他的合伙人想要创办一所英语培训机构,注册的时候要填一张个人情况的表格,在身高一栏小明犯了愁. 身高要求精确到厘米,但小明实在太高了,无法在纸上填下这么长的数字 ...
- C++里面virtual函数及虚表大小
实验了下面的函数: #include <vector> #include <iostream> using namespace std; class A { public: v ...
- google 分屏 横屏模式 按home键界面错乱故障分析(二) 分屏的启动过程
google 进入分屏后在横屏模式按home键界面错乱(二) 你确定你了解分屏的整个流程? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240&quo ...
- cocos2d-x嵌入移动MM短代支付IAP2.4的SDK,点击支付崩溃的解决的方法
凡是用IAP2.4,调用purchase.order 游戏崩溃.logcat报错是: 06-16 18:43:42.944: E/AndroidRuntime(8526): FATAL EXCEPTI ...
- Android开发工具之adt-bundle-windows
adt-bundle-windows是非常久之前的android开发工具.是集成了ADT版本号的eclipse,可是里面并没有下载SDK.这个须要自己单独下载,这个工具适合刚開始学习的人使用. 由于刚 ...
- Kurento应用开发指南(以Kurento 5.0为模板) 之中的一个:简单介绍,安装与卸载
文件夹 1. Kurento是什么 3 2. Kurento简单介绍 3 2.1 WebRTC媒体server ...
- thinkphp动态注册路由
thinkphp动态注册路由 一.总结 1.thinkphp使用路由步骤:a.config配置文件中开启路由 b.Route类的rule方法创建路由(在Routephp中)Route::rule(' ...
- 关于ES6(ES2015)的知识点详细总结
ECMAScript6 ECMAScript简称就是ES,你可以把它看成是一套标准,JavaScript就是实施了这套标准的一门语言,现在主流浏览器使用的是ECMAScript5. http://ba ...
- Python Tricks(二十)—— 阶乘的极简实现
使用 reduce # 比如计算 9 的阶乘 >> reduce(lambda x, y: x*y, range(1, 9+1)) 362880 当然这里的 reduce 直接返回具体的数 ...
- 单位转换 inch mm mil
从上面看:英寸(inch)是最大的单位 其次是毫米(mm) 再次是密耳(mil)