Skip to content

Commit

Permalink
加一个启动项目吧 大家比较好看效果
Browse files Browse the repository at this point in the history
  • Loading branch information
lemondreamtobe committed Dec 31, 2020
1 parent e8438b6 commit 8f069cd
Show file tree
Hide file tree
Showing 9 changed files with 4,718 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets":["es2015"]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

node_modules
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
一个简单的下雪和下雨效果
# 一个简单的下雪和下雨效果
## 想看雪吗
```
step1: yarn
step2: yarn start
```

1 change: 1 addition & 0 deletions dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body{
margin: 0px;
width: 100vw;
height: 100vh;
background: pink;
}
</style>
</head>
<body>
<script src="./bundle.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "snow",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --config webpack.config.js",
"start": "webpack-dev-server"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.12.10",
"babel-cli": "^6.26.0",
"babel-loader": "^8.2.2",
"babel-preset-es2015": "^6.24.1",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.11.1",
"webpack-cli": "3",
"webpack-dev-server": "^3.11.1"
}
}
5 changes: 3 additions & 2 deletions index.js → src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Snow {
export default class Snow {
constructor (opt = {}) {
// 是否是雨
this.isRain = opt.isRain || false
Expand Down Expand Up @@ -154,6 +154,7 @@ class Snows {
})
}
}

new Snows({
isRain: true,
num: 300,
Expand All @@ -162,4 +163,4 @@ new Snows({
new Snows({
isRain: false,
num: 150
})
})
12 changes: 12 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');

module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
devServer: {
contentBase: './dist'
},
};
Loading

0 comments on commit 8f069cd

Please sign in to comment.