1.0.0-beta.2 • Published 7 years ago

antd-mobile-ssr v1.0.0-beta.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

antd-mobile-ssr

antd-mobile for SSR.

If you are finding a web friendly version. Please invist antd-mobile-web

Install

npm i antd-mobile-ssr --save-dev

Follow official doc setup .babelrc

{
    "plugins": [
        [
            "import",
            {
                "libraryName": "antd-mobile-ssr"
            }
        ]
    ]
}

Reference css in your html page head. This is the easiest way to skip server render css issues.

<html>
    <head>
        <link rel='stylesheet' type='text/css' href='//unpkg.com/antd-mobile/dist/antd-mobile.min.css' />
        <link rel='stylesheet' type='text/css' href='//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css' />
    </head>
</html>

Then import components

import { Button } from 'antd-mobile-ssr'

How it work

This repo base on antd-mobile-web. It copy 'antd-mobile/lib' to root path. Then move '.web.js' to '.js'. Replace require(.web). Remove '.css' '.less' '.svg' and 'demo'.

Because this package dependencies antd-mobile. So you don't need install it again.

Special Icon component.

I modify react-fontawesome to replace it. So that you dont worry about how to render SVG on server side.