1
Fork 0

Build CSS and JS with hugo

This commit is contained in:
Jake Howard 2018-08-15 21:05:51 +01:00
parent 3e98bd1af8
commit 7b8e616bea
Signed by: jake
GPG key ID: 57AFB45680EDD477
7 changed files with 17 additions and 739 deletions

View file

@ -55,3 +55,5 @@ blackfriday:
theme:
- utils
assetDir: static/build/

View file

@ -8,7 +8,8 @@
<meta name="superfish" content="nofish" />
<meta name="application-name" content="{{ .Site.Title }}" />
<link rel="icon" type="image/png" href='{{ relURL "/img/logo-transparent.png" }}'/>
<link rel="stylesheet" href='{{ relURL "/css/style.css" }}' />
{{ partial "style.html" "scss/style.scss" }}
<title>{{ partial "title-item.html" (dict "page" . "current" .)}}{{ .Site.Title }}</title>
@ -21,11 +22,11 @@
{{ partial "footer.html" . }}
<script src='{{ relURL "/js/jquery.min.js" }}'></script>
<script src='{{ relURL "/js/lightgallery.js" }}'></script>
<script src='{{ relURL "/js/lg-thumbnail.min.js" }}'></script>
<script src='{{ relURL "/js/bootstrap.min.js" }}'></script>
<script src='{{ relURL "/js/mermaid.min.js" }}'></script>
<script src='{{ relURL "/js/app.js" }}'></script>
{{ partial "script.html" "js/jquery.min.js" }}
{{ partial "script.html" "js/lightgallery.js" }}
{{ partial "script.html" "js/lg-thumbnail.min.js" }}
{{ partial "script.html" "js/bootstrap.min.js" }}
{{ partial "script.html" "js/mermaid.min.js" }}
{{ partial "script.html" "js/app.js" }}
</body>
</html>

View file

@ -0,0 +1,2 @@
{{ $script := resources.Get . | minify | fingerprint }}
<script type="text/javascript" src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script>

View file

@ -0,0 +1,2 @@
{{ $style := resources.Get . | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" />

728
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,6 @@
"devDependencies": {
"eslint-config-dabapps": "github:dabapps/eslint-config-dabapps#v3.0.0",
"markdown-spellcheck": "1.3.1",
"node-sass": "4.9.0",
"parcel-bundler": "1.9.1",
"sass-lint": "1.12.1",
"yaml-lint": "1.2.3"

View file

@ -7,8 +7,8 @@ source ./scripts/common.sh
rm -rf $OUTPUT_DIR
rm -rf $STATIC_BUILD
rm -rf $BASEDIR/resources
mkdir -p $STATIC_BUILD/js $STATIC_BUILD/css
hugo gen chromastyles --style=tango > $STATIC_SRC/scss/highlight.css
mkdir -p $STATIC_BUILD/js $STATIC_BUILD/scss
hugo gen chromastyles --style=tango > $STATIC_BUILD/scss/highlight.scss
cp -r $BASEDIR/node_modules/lightgallery/dist/fonts $STATIC_BUILD
cp -r $STATIC_SRC/img $STATIC_BUILD/img
cp -r $BASEDIR/node_modules/lightgallery/dist/img/* $STATIC_BUILD/img
@ -19,7 +19,7 @@ cp -r $BASEDIR/node_modules/lg-thumbnail/dist/lg-thumbnail.min.js $STATIC_BUILD/
cp -r $BASEDIR/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js $STATIC_BUILD/js/bootstrap.min.js
parcel build $STATIC_SRC/js/index.js -d $STATIC_BUILD/js/ -o app.js
node-sass $STATIC_SRC/scss/style.scss $STATIC_BUILD/css/style.css --source-map-embed
cp -r $STATIC_SRC/scss/* $STATIC_BUILD/scss/
cp $BASEDIR/node_modules/mermaid/dist/mermaid.min.js $STATIC_BUILD/js/mermaid.min.js
hugo -vDEF --stepAnalysis --gc