Skip to content

Commit

Permalink
😺 准备dom结构
Browse files Browse the repository at this point in the history
  • Loading branch information
shalldie committed May 10, 2018
1 parent d3be6a6 commit 39494f0
Show file tree
Hide file tree
Showing 19 changed files with 12,474 additions and 26 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 谢爽
Copyright (c) 2018 shalldie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 9 additions & 3 deletions build/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ module.exports = {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
use: ['style-loader', 'css-loader', 'postcss-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
},
{
test: /\.(png|jpg|gif)$/,
use: ['url-loader']
},
{
test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.html$/,
use: ['html-loader']
}
]
}
Expand Down
32 changes: 31 additions & 1 deletion build/webpack.config.pro.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ const path = require('path');
const webpackConfig = require('./webpack.config.base.js');
const merge = require('webpack-merge');

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");

webpackConfig.module.rules.forEach(item => {
if (item.use[0] === 'style-loader') {
item.use[0] = MiniCssExtractPlugin.loader;
}
});

module.exports = merge(webpackConfig, {
mode: 'production',

Expand All @@ -13,6 +23,26 @@ module.exports = merge(webpackConfig, {
library: 'gitComment',
libraryTarget: 'umd',
libraryExport: 'default'
}
},

optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: false // set to true if you want JS source maps
}),
new OptimizeCSSAssetsPlugin({})
]
},

plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "[name].css"
// chunkFilename: "[id].css"
})
]

});
1 change: 1 addition & 0 deletions dist/git-comment.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body{background:#2ad;transition:.3s;animation:fdasf 3s linear}
10 changes: 9 additions & 1 deletion dist/git-comment.js

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

10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
</head>
<body>
<div id="root"></div>
<style>
#root {
box-sizing: border-box;
margin: 50px auto;
width: 800px;
min-height: 200px;
background: #fff;
border: 1px solid #ddd
}
</style>
<script src="/dist/index.js"></script>
</body>
</html>
Loading

0 comments on commit 39494f0

Please sign in to comment.