Skip to content
Permalink
Browse files

chore(build): yarn & webpack 4 & path & assets.json

  • Loading branch information
olOwOlo committed Jul 9, 2018
1 parent 687edf4 commit 619a42053f6c4f64b50badc321beda6e60119cba
@@ -0,0 +1,5 @@
{
"presets": ["env", "stage-3"],
"plugins": ["transform-runtime"],
"ignore": []
}
@@ -1,2 +1,2 @@
/src/node_modules/
/.idea/
node_modules/
.idea/
@@ -0,0 +1,6 @@
{
"even": {
"css": "even.e06a665f.min.css",
"js": "even.1029e815.min.js"
}
}
@@ -33,7 +33,7 @@
{{ with .Site.Params.googleVerification }}<meta name="google-site-verification" content="{{.}}" />{{ end }}

<!-- Site Generator -->
<meta name="generator" content="Hugo {{ .Hugo.Version }}" />
<meta name="generator" content="Hugo {{ .Hugo.Version }} with even 4.0.0" />

<!-- Permalink & RSSlink -->
<link rel="canonical" href="{{ .Permalink }}" />
@@ -61,7 +61,7 @@
{{- end }}

<!-- Styles -->
<link href="{{ "dist/even.min.css?v=3.2.0" | relURL }}" rel="stylesheet">
<link href="{{ print "dist/" .Site.Data.even.assets.even.css | relURL }}" rel="stylesheet">
{{ if .Site.Params.publicCDN.enable -}}
{{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxCSS | safeHTML }}{{ end }}
{{- else -}}
@@ -36,7 +36,7 @@
{{- end -}}
</script>
{{- if .Site.Params.publicCDN.enable -}}
{{ .Site.Params.publicCDN.flowchartDiagrams | safeHTML }}
{{ .Site.Params.publicCDN.flowchartDiagramsJS | safeHTML }}
{{- else -}}
<script src="{{ "lib/flowchartDiagrams/raphael-2.2.7.min.js" | relURL }}" integrity="sha256-67By+NpOtm9ka1R6xpUefeGOY8kWWHHRAKlvaTJ7ONI=" crossorigin="anonymous"></script>
<script src="{{ "lib/flowchartDiagrams/flowchart-1.8.0.min.js" | relURL }}" integrity="sha256-zNGWjubXoY6rb5MnmpBNefO0RgoVYfle9p0tvOQM+6k=" crossorigin="anonymous"></script>
@@ -63,7 +63,7 @@
<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="{{ "dist/even.min.js?v=3.2.0" | relURL }}"></script>
<script type="text/javascript" src="{{ print "dist/" .Site.Data.even.assets.even.js | relURL }}"></script>

{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/javascript">
@@ -0,0 +1,32 @@
{
"name": "even-src",
"version": "1.0.0",
"description": "even source file",
"main": "index.js",
"scripts": {
"start": "hugo server --source=exampleSite --themesDir=../.. --disableFastRender",
"build": "webpack"
},
"author": "ahonn, olOwOlo",
"license": "MIT",
"devDependencies": {
"assets-webpack-plugin": "^3.8.4",
"autoprefixer": "^8.6.5",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^1.0.0",
"file-loader": "^1.1.11",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.2",
"optimize-css-assets-webpack-plugin": "^4.0.3",
"postcss-loader": "^2.1.5",
"sass-loader": "^7.0.3",
"uglifyjs-webpack-plugin": "^1.2.7",
"webpack": "^4.15.1",
"webpack-cli": "^3.0.8"
}
}
@@ -4,4 +4,4 @@ module.exports = {
browsers: ['> 1%', 'last 2 versions', 'ie >= 9']
})
]
}
};

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,87 @@
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,
}
}
})
]
}
};

0 comments on commit 619a420

Please sign in to comment.
You can’t perform that action at this time.