Parcel-Storybook 项目教程

Parcel-Storybook 项目教程

parcel-storyDevelop your react components with parcel - A simple Alternative to storybook Using parceljs项目地址:https://gitcode.com/gh_mirrors/pa/parcel-story

1. 项目目录结构及介绍

parcel-story/
├── src/
│   ├── components/
│   ├── stories/
│   ├── index.html
│   └── index.js
├── .babelrc
├── .gitignore
├── LICENSE
├── README.md
└── package.json

目录结构说明

  • src/: 项目的源代码目录,包含所有前端代码。
    • components/: 存放 React 组件的目录。
    • stories/: 存放 Storybook 故事的目录。
    • index.html: 项目的主 HTML 文件。
    • index.js: 项目的主 JavaScript 文件。
  • .babelrc: Babel 配置文件,用于配置 JavaScript 的转译。
  • .gitignore: Git 忽略文件配置,指定哪些文件或目录不需要被 Git 管理。
  • LICENSE: 项目的开源许可证文件。
  • README.md: 项目的说明文档。
  • package.json: 项目的配置文件,包含项目的依赖、脚本等信息。

2. 项目启动文件介绍

index.js

index.js 是项目的入口文件,负责初始化 React 应用并渲染到 index.html 中。

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));

index.html

index.html 是项目的主 HTML 文件,包含一个 div 元素,用于挂载 React 应用。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Parcel Storybook</title>
</head>
<body>
  <div id="root"></div>
</body>
</html>

3. 项目配置文件介绍

package.json

package.json 是项目的配置文件,包含项目的依赖、脚本等信息。

{
  "name": "parcel-storybook",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "cross-env NODE_ENV=development parcel src/index.html",
    "build": "cross-env NODE_ENV=production parcel src/index.html"
  },
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "story-router": "^1.0.1"
  },
  "devDependencies": {
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "cross-env": "^5.1.3",
    "node-sass": "^4.7.2",
    "parcel-bundler": "^1.7.0"
  }
}

.babelrc

.babelrc 是 Babel 的配置文件,用于配置 JavaScript 的转译。

{
  "presets": ["env", "react"],
  "plugins": ["transform-class-properties"]
}

.gitignore

.gitignore 是 Git 忽略文件配置,指定哪些文件或目录不需要被 Git 管理。

node_modules/
dist/
.cache/

LICENSE

LICENSE 是项目的开源许可证文件,通常包含 MIT 许可证的内容。

README.md

README.md 是项目的说明文档,通常包含项目的介绍、安装步骤、使用说明等内容。

# Parcel-Storybook

Develop your components with parcel - A simple Alternative to storybook Using parceljs.

## Getting Started

1. Clone the repository:
   ```bash
   git clone https://github.com/yjose/parcel-storybook.git
  1. Install dependencies:

    yarn install
    
  2. Start the development server:

    yarn start
    

License

This project is licensed under the MIT License.

parcel-storyDevelop your react components with parcel - A simple Alternative to storybook Using parceljs项目地址:https://gitcode.com/gh_mirrors/pa/parcel-story

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云含荟Gilbert

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值