Skip to content

Commit

Permalink
Init Project
Browse files Browse the repository at this point in the history
  • Loading branch information
satouriko committed Oct 10, 2017
0 parents commit af623bd
Show file tree
Hide file tree
Showing 19 changed files with 4,794 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"es2015"
],
"plugins": []
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.idea/
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 先锋网络中心

东北大学先锋网络中心介绍页&招新报名页面!

## 开发指南

### 安装

```
yarn install
```

### 调试

```
yarn run dev
```

### 组建

```
yarn run build
```

### 目录

```
.
├── node_modules
├── package.json
├── public
│   ├── dist
│   │   └── bundle.e47e84525136281a3187.js
│   ├── img
│   │   ├── background.79d902a3fa19f9b8b7d44aa8d999a13f.png
│   │   └── frontground.c735102255958d5ccf031f20038c0d7f.gif
│   ├── index.html
│   └── static
│   └── hello.487deb0527aa4445bfa958e3dd999279.md
├── README.md
├── src
│   ├── img
│   │   ├── background.png
│   │   └── frontground.gif
│   ├── js
│   │   └── index.js
│   ├── main.js
│   ├── md
│   │   └── hello.md
│   ├── scss
│   │   └── index.scss
│   └── tmpl
│   └── index.html
├── webpack.config.js
└── yarn.lock
```

+ JS文件请放在 src/js 目录下,SCSS 文件请放在 src/scss 目录下,HTML 文件请放在 src/tmpl 目录下,MARKDOWN 文件请放在 src/md 目录下。
+ SCSS 完全兼容 CSS 语法,请将所有样式表文件命名为 .scss 后缀。请充分按照模块化的原则创作 CSS 类。
+ 请使用 ECMAScript6 的风格和 API 编写 JS 文件。请充分按照模块化的原则创作 JS 模块。
+ 编译时,Webpack 自动打包生成 public 下的内容。
+ 要添加 CSS、JS、MARKDOWN,请在 src/main.js 中 import。要添加 HTML 文件,请在 webpack.config.js 中加入如下代码块
```
new HtmlWebpackPlugin({
filename: "index.html",
template: __dirname + "/src/tmpl/index.html"
}),
```
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "neupioneer",
"description": "Homepage of NEU Pioneer.",
"version": "1.0.0",
"author": "neupioneer <[email protected]>",
"private": true,
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"css-loader": "^0.28.7",
"file-loader": "^1.1.5",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^2.30.1",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"style-loader": "^0.19.0",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
},
"scripts": {
"build": "rm -rf public && webpack",
"dev": "webpack-dev-server --open --hot"
}
}
1 change: 1 addition & 0 deletions public/dist/bundle.3be787570e0293232a6e.js

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html> <html> <head> <meta charset=UTF-8> <title>Document</title> </head> <body> <h1>Header</h1> <img src=img/frontground.c735102255958d5ccf031f20038c0d7f.gif> <script type="text/javascript" src="./dist/bundle.3be787570e0293232a6e.js"></script></body> </html>
1 change: 1 addition & 0 deletions public/static/hello.487deb0527aa4445bfa958e3dd999279.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# hello
Binary file added src/img/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/frontground.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("helloindex")
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './scss/index.scss'
import './js/index'
import './md/hello.md'
1 change: 1 addition & 0 deletions src/md/hello.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# hello
3 changes: 3 additions & 0 deletions src/scss/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background-image: url(../img/background.png);
}
1 change: 1 addition & 0 deletions src/tmpl/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Header</h1>
12 changes: 12 additions & 0 deletions src/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<!-- 这是注释! -->
${require('./header.html')}
<img src="../img/frontground.gif">
</body>
</html>
42 changes: 42 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: "./src/main.js",
output: {
path: __dirname + '/public',
filename: "./dist/bundle.[hash].js"
},
module: {
loaders: [
{ test: /\.js$/,loader: "babel-loader" },
{ test: /\.scss$/,loader: "style-loader!css-loader!sass-loader" },
{ test: /\.css$/,loader: 'style-loader!css-loader' },
{ test: /\.(png|jpe?g|gif|svg)$/,loader: 'file-loader',options: { name: 'img/[name].[hash].[ext]' } },
{ test: /\.(eot|ttf|woff|woff2)$/,loader: 'file-loader',options: { name: 'font/[name].[hash].[ext]' } },
{ test: /\.md$/,loader: 'file-loader',options: { name: 'static/[name].[hash].[ext]' } },
{ test: /\.html$/, loader: "html-loader?interpolate&minimize&removeComments" }
]
},
resolve: {
extensions: ['.js', '.jsx']
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
except: ['$super', '$', 'exports', 'require']
}),
new HtmlWebpackPlugin({
filename: "index.html",
template: __dirname + "/src/tmpl/index.html"
}),
],
devtool:'eval-source-map',
devServer: {
contentBase: "./public/",
historyApiFallback: true,
inline: true
},
};
Loading

0 comments on commit af623bd

Please sign in to comment.