Skip to content

Commit 39494f0

Browse files
committed
😺 准备dom结构
1 parent d3be6a6 commit 39494f0

19 files changed

+12474
-26
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 谢爽
3+
Copyright (c) 2018 shalldie
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build/webpack.config.base.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ module.exports = {
1313
rules: [
1414
{
1515
test: /\.css$/,
16-
use: ['style-loader', 'css-loader']
16+
use: ['style-loader', 'css-loader', 'postcss-loader']
1717
},
1818
{
1919
test: /\.scss$/,
20-
use: ['style-loader', 'css-loader', 'sass-loader']
20+
use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
2121
},
2222
{
2323
test: /\.(png|jpg|gif)$/,
2424
use: ['url-loader']
2525
},
2626
{
27-
test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"
27+
test: /\.js$/,
28+
exclude: /node_modules/,
29+
use: ['babel-loader']
30+
},
31+
{
32+
test: /\.html$/,
33+
use: ['html-loader']
2834
}
2935
]
3036
}

build/webpack.config.pro.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ const path = require('path');
22
const webpackConfig = require('./webpack.config.base.js');
33
const merge = require('webpack-merge');
44

5+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
6+
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
7+
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
8+
9+
webpackConfig.module.rules.forEach(item => {
10+
if (item.use[0] === 'style-loader') {
11+
item.use[0] = MiniCssExtractPlugin.loader;
12+
}
13+
});
14+
515
module.exports = merge(webpackConfig, {
616
mode: 'production',
717

@@ -13,6 +23,26 @@ module.exports = merge(webpackConfig, {
1323
library: 'gitComment',
1424
libraryTarget: 'umd',
1525
libraryExport: 'default'
16-
}
26+
},
27+
28+
optimization: {
29+
minimizer: [
30+
new UglifyJsPlugin({
31+
cache: true,
32+
parallel: true,
33+
sourceMap: false // set to true if you want JS source maps
34+
}),
35+
new OptimizeCSSAssetsPlugin({})
36+
]
37+
},
38+
39+
plugins: [
40+
new MiniCssExtractPlugin({
41+
// Options similar to the same options in webpackOptions.output
42+
// both options are optional
43+
filename: "[name].css"
44+
// chunkFilename: "[id].css"
45+
})
46+
]
1747

1848
});

dist/git-comment.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body{background:#2ad;transition:.3s;animation:fdasf 3s linear}

dist/git-comment.js

+9-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
</head>
77
<body>
88
<div id="root"></div>
9+
<style>
10+
#root {
11+
box-sizing: border-box;
12+
margin: 50px auto;
13+
width: 800px;
14+
min-height: 200px;
15+
background: #fff;
16+
border: 1px solid #ddd
17+
}
18+
</style>
919
<script src="/dist/index.js"></script>
1020
</body>
1121
</html>

0 commit comments

Comments
 (0)