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的更多相关文章

  1. 解决Type safety: The expression of type List needs

    解决Type safety: The expression of type List needs unchecked conversion to conform to 在方法前加上这句话就可以了@Su ...

  2. [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 ...

  3. [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 ...

  4. [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 ...

  5. 给 input 中 type="text" 设置CSS样式

    input[type="text"], input[type="password"] {    border: 1px solid #ccc;    paddi ...

  6. 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 ...

  7. CSS:给 input 中 type="text" 设置CSS样式

    input[type="text"], input[type="password"] {    border: 1px solid #ccc;    paddi ...

  8. java中的类型安全问题-Type safety: Unchecked cast from Object to ...

    首先,java语言室类型安全的,通常我们遇到这个问题是出现在Object转化为目标类型时, 这个转化并不是安全的.这个问题普遍认为因为使用了jdk1.5或者1.6的泛型, request.getAtt ...

  9. Type safety: Unchecked cast from Object to ArrayList

    表明Object转化为ArrayList这个转化并不是安全的.. 编译的时候需要加入修饰符才能正常编译(具体是那个修饰符..不记得了.^_^),否则会提示有警告 当然这只是一个警告,如果楼主自信这个转 ...

随机推荐

  1. easyui 前端实现分页 复制就能用

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. Flask框架简介

    Flask框架诞生于2010年,是Armin ronacher 用python语言基于Werkzeug工具箱编写的轻量级Web开发框架! Flask本身相当于一个内核,其他几乎所有的功能都要用到扩展. ...

  3. 从硬件到语言,详解C++的内存对齐(memory alignment)(一)

    作者:赵宗晟 出处:https://www.cnblogs.com/zhao-zongsheng/p/9099603.html 很多写C/C++的人都知道“内存对齐”的概念以及规则,但不一定对他有很深 ...

  4. UICollectionView 集合视图 的使用

    直接上代码: // // RootViewController.m // // #import "RootViewController.h" #import "Colle ...

  5. Android记录16-友盟第三方登录、分享实现

    Android开发记录16-友盟第三方登录.分享实现 2014年博客之星,投票地址username=wwj_748#content" style="font-family: Kai ...

  6. php课程 12-40 抽象类的作用是什么

    php课程 12-40 抽象类的作用是什么 一.总结 一句话总结:定标准的 1.继承的关键词有哪两个? extendsparent 2.抽象类的实际意义是什么? 制造符合规范的产品你必须实现了抽象类里 ...

  7. golang sync.RWMutex

    sync.RWMutex package main import ( "fmt" "runtime" "sync" ) func click ...

  8. POJ Fence Repair(优先队列)

    Fence Repair Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 51346   Accepted: 16857 De ...

  9. 洛谷——P1823 音乐会的等待

    https://www.luogu.org/problem/show?pid=1823 题目描述 N个人正在排队进入一个音乐会.人们等得很无聊,于是他们开始转来转去,想在队伍里寻找自己的熟人.队列中任 ...

  10. [Javascript] Different ways to create an new array/object based on existing array/object

    Array: 1. slice() const newAry = ary.slice() 2. concat const newAry = [].concat(ary) 3. spread oprea ...