mirror of
https://git.adityakumar.xyz/hugo-theme-even.git
synced 2024-11-08 14:39:44 +00:00
chore(build): drop webpack and use Hugo Pipes (#130)
This commit is contained in:
parent
d39d3e4439
commit
5657112dfb
51 changed files with 8 additions and 5830 deletions
5
.babelrc
5
.babelrc
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"presets": ["@babel/preset-env"],
|
||||
"plugins": ["@babel/plugin-transform-runtime"],
|
||||
"ignore": []
|
||||
}
|
13
README-zh.md
13
README-zh.md
|
@ -68,19 +68,6 @@ defaultContentLanguage = "en" # en / zh-cn / other...
|
|||
|
||||
主题内置了五种颜色 ( Default | Mint Green | Cobalt Blue | Hot Pink | Dark Violet ),你可以通过改变 [`/src/css/_variable.scss`](https://github.com/olOwOlo/hugo-theme-even/blob/master/src/css/_variables.scss#L5-L8) 文件中 `$theme-color-config` 的值来改变主题的颜色。
|
||||
|
||||
## Build
|
||||
|
||||
如果你更改了 `/src/` 目录下的任意文件,你需要重新编译它们。
|
||||
```bash
|
||||
cd ./themes/even/
|
||||
# install dependencies
|
||||
yarn install
|
||||
# build
|
||||
yarn build
|
||||
```
|
||||
|
||||
_你需要先安装 **[Yarn](https://yarnpkg.com/)** 和 **[Node.js](https://nodejs.org/)**。_
|
||||
|
||||
## Update Theme
|
||||
|
||||
```bash
|
||||
|
|
13
README.md
13
README.md
|
@ -68,19 +68,6 @@ This theme provides `center`,` right`, `left`,` music`, `admonition` shortcodes,
|
|||
|
||||
There are five built-in theme colors ( Default | Mint Green | Cobalt Blue | Hot Pink | Dark Violet ), you can config it by changing the `$theme-color-config` value in [`/src/css/_variable.scss`](https://github.com/olOwOlo/hugo-theme-even/blob/master/src/css/_variables.scss#L5-L8).
|
||||
|
||||
## Build
|
||||
|
||||
If you changed any file under `/src/`, you need to rebuild.
|
||||
```bash
|
||||
cd ./themes/even/
|
||||
# install dependencies
|
||||
yarn install
|
||||
# build
|
||||
yarn build
|
||||
```
|
||||
|
||||
_You need to install **[Yarn](https://yarnpkg.com/)** and **[Node.js](https://nodejs.org/)** first._
|
||||
|
||||
## Update Theme
|
||||
|
||||
```bash
|
||||
|
|
|
@ -277,4 +277,3 @@ Even.responsiveTable = function() {
|
|||
}
|
||||
};
|
||||
|
||||
export {Even}
|
|
@ -1,7 +1,3 @@
|
|||
import {Even} from './even.js'
|
||||
|
||||
import '../css/style.scss'
|
||||
|
||||
$(document).ready(function () {
|
||||
Even.backToTop();
|
||||
Even.mobileNavbar();
|
|
@ -61,7 +61,8 @@
|
|||
{{- end -}}
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ print "dist/" .Site.Data.even.assets.even.css | relURL }}" rel="stylesheet">
|
||||
{{ $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint }}
|
||||
<link href="{{ $style.Permalink }}" rel="stylesheet">
|
||||
{{ if .Site.Params.publicCDN.enable -}}
|
||||
{{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxCSS | safeHTML }}{{ end }}
|
||||
{{- else -}}
|
||||
|
|
|
@ -67,7 +67,10 @@
|
|||
<link rel="stylesheet" href="{{ "lib/js-sequence-diagrams/sequence-diagram-2.0.1.min.css" | relURL }}" integrity="sha384-6QbLKJMz5dS3adWSeINZe74uSydBGFbnzaAYmp+tKyq60S7H2p6V7g1TysM5lAaF" crossorigin="anonymous">
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
<script type="text/javascript" src="{{ print "dist/" .Site.Data.even.assets.even.js | relURL }}"></script>
|
||||
{{ $even := resources.Get "js/even.js" }}
|
||||
{{ $main := resources.Get "js/main.js" }}
|
||||
{{ $js := slice $even $main | resources.Concat "js/main.js" | fingerprint }}
|
||||
<script type="text/javascript" src="{{ $js.Permalink }}"></script>
|
||||
|
||||
{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
|
||||
<script type="text/javascript">
|
||||
|
|
32
package.json
32
package.json
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "even-src",
|
||||
"version": "1.0.0",
|
||||
"description": "even source file",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "hugo server --source=exampleSite --themesDir=../.. --disableFastRender",
|
||||
"build": "webpack",
|
||||
"watch": "webpack --watch --progress --colors"
|
||||
},
|
||||
"author": "ahonn, olOwOlo",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/plugin-transform-runtime": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"assets-webpack-plugin": "^3.9.7",
|
||||
"autoprefixer": "^9.3.1",
|
||||
"babel-loader": "^8.0.4",
|
||||
"clean-webpack-plugin": "^0.1.19",
|
||||
"css-loader": "^1.0.1",
|
||||
"file-loader": "^2.0.0",
|
||||
"mini-css-extract-plugin": "^0.4.4",
|
||||
"node-sass": "^4.10.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"sass-loader": "^7.1.0",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"webpack": "^4.25.0",
|
||||
"webpack-cli": "^3.1.2"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer')({
|
||||
browsers: ['> 1%', 'last 2 versions', 'ie >= 9']
|
||||
})
|
||||
]
|
||||
};
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
@ -1,87 +0,0 @@
|
|||
const path = require('path');
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
|
||||
const AssetsWebpackPlugin = require('assets-webpack-plugin');
|
||||
|
||||
const extractSass = new MiniCssExtractPlugin({
|
||||
filename: `even.[contenthash:8].min.css`
|
||||
});
|
||||
|
||||
const cleanBuild = new CleanWebpackPlugin([
|
||||
'static/dist/*'
|
||||
]);
|
||||
|
||||
const assetsManifest = new AssetsWebpackPlugin({
|
||||
filename: 'assets.json',
|
||||
path: path.join(__dirname, 'data/even'),
|
||||
fullPath: false,
|
||||
processOutput: assets => {
|
||||
const output = {};
|
||||
Object.keys(assets)
|
||||
.filter(bundle => bundle !== '')
|
||||
.forEach(bundle => output[bundle] = assets[bundle]);
|
||||
return JSON.stringify(output, null, 2);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
devtool: 'source-map',
|
||||
entry: {
|
||||
even: path.join(__dirname, 'src/js/main.js')
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'static/dist'),
|
||||
filename: `[name].[contenthash:8].min.js`,
|
||||
chunkFilename: '[name].[contenthash:8].min.js',
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader'
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: 'css-loader', options: { minimize: true, sourceMap: true }
|
||||
}, {
|
||||
loader: 'postcss-loader', options: { sourceMap: true }
|
||||
}, {
|
||||
loader: 'sass-loader', options: { sourceMap: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /iconfont\.(woff|woff2|eot|ttf|otf|svg)$/,
|
||||
use: ['file-loader?name=[path][name].[ext]?hash=[hash:7]']
|
||||
},
|
||||
{
|
||||
test: /apple-chancery-webfont\.(woff|woff2|eot|ttf|otf|svg)$/,
|
||||
use: ['file-loader?name=[path][name].[ext]']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [extractSass, assetsManifest, cleanBuild],
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new UglifyJsPlugin({
|
||||
parallel: true,
|
||||
sourceMap: true,
|
||||
}),
|
||||
new OptimizeCSSAssetsPlugin({
|
||||
cssProcessorOptions: {
|
||||
map: {
|
||||
inline: false,
|
||||
annotation: true,
|
||||
}
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue