dash html中文文档,GitHub - plotly/dash-html-components: HTML components for Dash

dash-html-components

Vanilla HTML components for Dash

Install dependencies

Create a virtual env and activate.

$ virtualenv venv

$ venv/bin/activate

Note: venv\Scripts\activate for Windows

Install Python packages required to build components.

$ pip install -r dev-requirements.txt

Generate components and install npm packages

$ npm install

Generating HTML Components

The components in src/components, as well as the export index in

src/index.js are programmatically generated from element definitions in

scripts/. To regenerate:

$ npm run generate-components

The list of attributes is regenerated by scraping the

MDN HTML attribute reference.

Note: This step will have already been done for you when you ran npm install

Development

Testing your components in Dash

Watch for changes

$ npm run build:watch

Install module locally (after every change)

# Generate metadata, and build the JavaScript bundle

$ npm run install-local

# Now you're done. For subsequent changes, if you've got `npm run build:watch`

$ python setup.py install

Run the Dash layout you want to test

# Import dash_html_components to your layout, then run it:

$ python my_dash_layout.py

Installing Python package locally

Before publishing to PyPi, you can test installing the module locally:

# Install in `site-packages` on your machine

$ npm run install-local

Uninstalling Python package locally

$ npm run uninstall-local

Contributing

See the contributing guide for guidelines on contributing to this project.

Create a production build and publish:

Build your code:

$ npm run build

Create a Python tarball

$ python setup.py sdist

This distribution tarball will get generated in the dist/ folder

Test your tarball by copying it into a new environment and installing it locally:

$ pip install dash-html-components-.tar.gz

If it works, then you can publish the component to NPM and PyPI:

Publish on PyPI

$ twine upload dist/*

Cleanup the dist folder (optional)

$ rm -rf dist

Publish on NPM (Optional if chosen False in publish_on_npm)

$ npm publish

Publishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash servers the component library's CSS and JS from the remote unpkg CDN, so if you haven't published the component package to NPM you'll need to set the serve_locally flags to True (unless you choose False on publish_on_npm). We will eventually make serve_locally=True the default, follow our progress in this issue.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值