Skip to content
Permalink
Browse files

Big change of build system, from rollup to webpack

  • Loading branch information...
laozhu committed May 19, 2018
1 parent 4095eac commit 92c85a98e3dbbd7fee14281b8a2f19e50f11c550
Showing with 8,723 additions and 6,022 deletions.
  1. +0 βˆ’8 .babelrc
  2. +1 βˆ’1 .editorconfig
  3. +0 βˆ’12 .eslintrc
  4. +2 βˆ’0 .gitignore
  5. +0 βˆ’3 .stylelintrc
  6. +26 βˆ’24 README.md
  7. +4 βˆ’0 data/manifest.json
  8. +1 βˆ’1 layouts/partials/footer.html
  9. +1 βˆ’1 layouts/partials/head.html
  10. +0 βˆ’4,803 package-lock.json
  11. +131 βˆ’49 package.json
  12. +0 βˆ’21 rollup.config.js
  13. BIN src/{images β†’ assets}/avatar.jpg
  14. BIN src/{images β†’ assets}/cover.jpg
  15. BIN src/{images β†’ assets}/favicon-16x16.png
  16. BIN src/{images β†’ assets}/favicon-32x32.png
  17. BIN src/{images β†’ assets}/favicon.ico
  18. BIN src/{images β†’ assets}/poster.jpg
  19. BIN src/{images β†’ assets}/qrcode.jpg
  20. 0 src/{images β†’ assets}/safari-pinned-tab.svg
  21. BIN src/{images β†’ assets}/tile-image-windows.png
  22. BIN src/{images β†’ assets}/touch-icon-android.png
  23. BIN src/{images β†’ assets}/touch-icon-apple.png
  24. +5 βˆ’0 { β†’ src}/index.js
  25. +2 βˆ’0 src/robots.txt
  26. +15 βˆ’0 src/styles/main.css
  27. +0 βˆ’15 src/styles/main.scss
  28. +91 βˆ’91 src/styles/partials/{content.scss β†’ content.css}
  29. +25 βˆ’25 src/styles/partials/{header.scss β†’ header.css}
  30. +26 βˆ’39 src/styles/partials/{icons.scss β†’ icons.css}
  31. +10 βˆ’11 src/styles/partials/{links.scss β†’ links.css}
  32. +87 βˆ’0 src/styles/partials/misc.css
  33. +0 βˆ’87 src/styles/partials/misc.scss
  34. +36 βˆ’0 src/styles/partials/paginator.css
  35. +0 βˆ’36 src/styles/partials/paginator.scss
  36. +23 βˆ’23 src/styles/partials/{post.scss β†’ post.css}
  37. +3 βˆ’0 src/styles/partials/reset.css
  38. +0 βˆ’447 src/styles/partials/reset.scss
  39. +11 βˆ’11 src/styles/partials/{shortcodes.scss β†’ shortcodes.css}
  40. +29 βˆ’29 src/styles/partials/{skeleton.scss β†’ skeleton.css}
  41. +16 βˆ’16 src/styles/partials/{summary.scss β†’ summary.css}
  42. 0 src/styles/partials/{syntax.scss β†’ syntax.css}
  43. +119 βˆ’0 src/styles/partials/table.css
  44. +0 βˆ’129 src/styles/partials/table.scss
  45. +9 βˆ’9 src/styles/partials/{terms.scss β†’ terms.css}
  46. +149 βˆ’0 src/styles/partials/variables.css
  47. +0 βˆ’119 src/styles/partials/variables.scss
  48. +0 βˆ’2 static/css/bundle.css
  49. +0 βˆ’7 static/css/bundle.css.map
  50. +3 βˆ’0 static/css/bundle.f65b34a43d.css
  51. +1 βˆ’0 static/css/bundle.f65b34a43d.css.map
  52. BIN static/{img β†’ }/favicon.ico
  53. BIN static/fonts/{iconfont.ttf β†’ iconfont.51416090d6.ttf}
  54. BIN static/fonts/{iconfont.woff2 β†’ iconfont.93b87d70b7.woff2}
  55. 0 static/fonts/{iconfont.svg β†’ iconfont.9b5f8b8193.svg}
  56. BIN static/fonts/{iconfont.eot β†’ iconfont.9e583b2052.eot}
  57. BIN static/fonts/{iconfont.woff β†’ iconfont.c3f55386bc.woff}
  58. BIN static/fonts/{lobster.woff β†’ lobster.209fc0ad0f.woff}
  59. BIN static/fonts/{lobster.eot β†’ lobster.593ab80a1f.eot}
  60. BIN static/fonts/{lobster.woff2 β†’ lobster.8beaa26e6d.woff2}
  61. 0 static/fonts/{lobster.svg β†’ lobster.d2cd0d1f6d.svg}
  62. BIN static/fonts/{lobster.ttf β†’ lobster.dc1a4773ed.ttf}
  63. 0 static/img/{grey-prism.svg β†’ grey-prism.5e2487237b.svg}
  64. +2 βˆ’0 static/js/bundle.ea7fd5ac63.js
  65. +1 βˆ’0 static/js/bundle.ea7fd5ac63.js.map
  66. +0 βˆ’2 static/js/bundle.js
  67. +0 βˆ’1 static/js/bundle.js.map
  68. +140 βˆ’0 webpack.config.js
  69. +7,754 βˆ’0 yarn.lock

This file was deleted.

@@ -9,4 +9,4 @@ trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
trim_trailing_whitespace = false

This file was deleted.

@@ -5,3 +5,5 @@ npm-debug.log
yarn-error.log
node_modules
!.gitignore


This file was deleted.

@@ -249,41 +249,43 @@ Write your portfolio as a post here, if you want comments in about page, you sho

## Build

If you want to modify styles and scripts by yourself, you should install dev packages by `npm install`, I use [sass](http://sass-lang.com/) for styles development, [rollup](https://github.com/rollup/rollup) for scripts development, inside the folder of your Hugo site run:
> **⚠️ Big Change**
>
> npm => yarn
>
> rollup => webpack
>
> SASS => PostCSS
In the new build system, I use webpack to generate dist files and a `manifest.json` file which lists all dist scripts and styles, then I use hugo data template to read the `manifest.json` content and insert them into the html layout. In this way I can use webpack chunkHash for browser cache and I don't need to change the layout.

```bash
# Install dependences
# Install all dependences
$ cd themes/hugo-nuo
$ npm install
# Scripts dev
$ npm run dev
$ npm run build
# Styles dev
$ npm run sass
$ yarn
# Copy fonts to static
$ npm run fonts
# Development watch
$ yarn dev
# Copy images to static
$ npm run images
# Build static files for production
$ yarn build
# Scripts lint
$ npm run eslint
# Scripts lint and autofix
$ yarn eslint
$ yarn eslint:fix
# Styles lint
$ npm run stylelint
# Styles lint and autofix
$ yarn stylelint
$ yarn stylelint:fix
# Minify images
$ npm run imagemin
```
$ yarn imagemin
If you want to build hugo-nuo theme, you should have `node` and `npm` evironment installed. Besides, you should have dependencies below installed.
# Clean
$ yarn clean
```

* [ImageOptim](https://imageoptim.com/) - Makes images load faster
* [SASS](http://sass-lang.com/install) - Ruby version SASS compiler
* [Pygments](http://pygments.org/) - Python syntax hightlighter
I use [ImageOptim](https://imageoptim.com/) to make images load faster, you should install this app before you run `yarn imagemin` script.

*From Hugo 0.28, the default syntax hightlighter in Hugo is [Chroma](https://github.com/alecthomas/chroma); it is built in Go and is really, really fast – and for the most important parts compatible with [Pygments](http://pygments.org/).*

@@ -0,0 +1,4 @@
{
"bundle.css": "/css/bundle.f65b34a43d.css",
"bundle.js": "/js/bundle.ea7fd5ac63.js"
}
@@ -32,7 +32,7 @@
});
</script>
{{ end }}
<script src="{{ "/js/bundle.js" | relURL }}"></script>
<script src="{{ index .Site.Data.manifest "bundle.js" | relURL }}"></script>
{{ if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
@@ -93,4 +93,4 @@
{{ if ne .Kind "home" }}
<link rel="stylesheet" href="//cdn.bootcss.com/video.js/6.2.8/alt/video-js-cdn.min.css" />
{{ end }}
<link rel="stylesheet" href="{{ "/css/bundle.css" | relURL }}" />
<link rel="stylesheet" href="{{ index .Site.Data.manifest "bundle.css" | relURL }}" />

0 comments on commit 92c85a9

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