server icon indicating copy to clipboard operation
server copied to clipboard

How can I get the generated html files?

Open viocha opened this issue 2 years ago • 2 comments

I would like to save the static html files to local and how can I do this?

viocha avatar Nov 06 '23 14:11 viocha

I copy dev to build and modified some configurations.

#!/bin/bash

: ${1?"Usage: $0 <server language>"}

set -e

export NODE_LANG=$1
export TUTORIAL_LANG=$1
export NODE_ENV=production
export ASSET_VERSIONING=query
export WATCH=0
export SITE_HOST=http://javascript.local
export TUTORIAL_EDIT=
export NODE_PRESERVE_SYMLINKS=1
export NODE_OPTIONS=--openssl-legacy-provider

# Use a local bunyan if no other is found in the current environment
if ! [ -x "$(command -v bunyan)" ]; then
  export PATH="$PATH:./node_modules/bunyan/bin"
fi

npm run gulp build

Then tried to run ./build en, the build process seemed stuck and not static html files generated.

Details
@liudonghua123 ➜ /workspaces/javascript.info (master) $ rm -rf public/* && ./build en

> [email protected] gulp
> cross-env NODE_PRESERVE_SYMLINKS=1 NODE_PATH=./modules ./node_modules/.bin/gulp build

[10:42:49] Using gulpfile /workspaces/javascript.info/gulpfile.js
[10:42:49] Starting 'build'...
[10:42:49] Starting 'webpack'...
(node:39856) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(Use `node --trace-deprecation ...` to show where the warning was created)
[webpack] Time: 4175ms
Built at: 02/04/2024 10:42:55 AM
                                                                       Asset       Size  Chunks                         Chunk Names
                                                 ../all-lang/libs/animate.js  469 bytes          [emitted]              
                                            ../all-lang/libs/class-extend.js   3.95 KiB          [emitted]              
                                 ../all-lang/libs/compareDocumentPosition.js  970 bytes          [emitted]              
                                                      ../all-lang/libs/d3.js    143 KiB          [emitted]              
                                          ../all-lang/libs/documentScroll.js   1.15 KiB          [emitted]              
                                                ../all-lang/libs/domtree.css  313 bytes          [emitted]              
                                                 ../all-lang/libs/domtree.js   5.68 KiB          [emitted]              
                                             ../all-lang/libs/event-mixin.js   1.25 KiB          [emitted]              
                                               ../all-lang/libs/getCoords.js  819 bytes          [emitted]              
                             ../img/favicon/apple-touch-icon-precomposed.png   5.86 KiB          [emitted]              
                                                  ../img/favicon/favicon.ico    5.3 KiB          [emitted]              
                                                  ../img/favicon/favicon.png   1.29 KiB          [emitted]              
                                                 ../img/favicon/tileicon.png   4.82 KiB          [emitted]              
                                                           ../libs/lodash.js    458 KiB          [emitted]              
                                              footer.js?884698c25f6324692778   4.59 KiB       0  [emitted] [immutable]  footer
                                      frontpage.css.map?884698c25f6324692778   8.89 KiB       1  [emitted] [dev]        frontpage
                                          frontpage.css?884698c25f6324692778   7.47 KiB       1  [emitted] [immutable]  frontpage
                                           frontpage.js?884698c25f6324692778   1.13 KiB       1  [emitted] [immutable]  frontpage
                                                head.js?884698c25f6324692778   19.3 KiB       2  [emitted] [immutable]  head
      modules/styles/blocks/font/icons.woff?b9ad9f78107447198d61a582feac1862     19 KiB          [emitted]              
modules/styles/blocks/page-footer/slack.svg?8559a3750105522de87657cad56c63d1   1.49 KiB          [emitted]              
                                         styles.css.map?884698c25f6324692778    261 KiB       3  [emitted] [dev]        styles
                                             styles.css?884698c25f6324692778    221 KiB       3  [emitted] [immutable]  styles
                                              styles.js?884698c25f6324692778   1.13 KiB       3  [emitted] [immutable]  styles
                                            tutorial.js?884698c25f6324692778   94.2 KiB       4  [emitted] [immutable]  tutorial
Entrypoint head = head.js?884698c25f6324692778
Entrypoint footer = footer.js?884698c25f6324692778
Entrypoint tutorial = tutorial.js?884698c25f6324692778
Entrypoint styles = styles.css?884698c25f6324692778 styles.js?884698c25f6324692778 styles.css.map?884698c25f6324692778
Entrypoint frontpage = frontpage.css?884698c25f6324692778 frontpage.js?884698c25f6324692778 frontpage.css.map?884698c25f6324692778
Child mini-css-extract-plugin node_modules/css-loader/index.js??ref--7-1!node_modules/postcss-loader/src/index.js??ref--7-2!modules/engine/webpack/hover-loader.js!node_modules/stylus-loader/index.js??ref--7-4!tmp/en/frontpage.styl:
    Entrypoint mini-css-extract-plugin = *
Child mini-css-extract-plugin node_modules/css-loader/index.js??ref--7-1!node_modules/postcss-loader/src/index.js??ref--7-2!modules/engine/webpack/hover-loader.js!node_modules/stylus-loader/index.js??ref--7-4!tmp/en/styles.styl:
    Entrypoint mini-css-extract-plugin = *
[10:42:55] Finished 'webpack' after 5.51 s
[10:42:55] Finished 'build' after 5.51 s

# STUCK HERE!!!
@liudonghua123 ➜ /workspaces/javascript.info (master) $ du -sh public/
1.4M    public/
@liudonghua123 ➜ /workspaces/javascript.info (master) $ tree public/
public/
└── en
    ├── all-lang
    │   └── libs
    │       ├── animate.js
    │       ├── class-extend.js
    │       ├── compareDocumentPosition.js
    │       ├── d3.js
    │       ├── documentScroll.js
    │       ├── domtree.css
    │       ├── domtree.js
    │       ├── event-mixin.js
    │       └── getCoords.js
    ├── img
    │   └── favicon
    │       ├── apple-touch-icon-precomposed.png
    │       ├── favicon.ico
    │       ├── favicon.png
    │       └── tileicon.png
    ├── libs
    │   └── lodash.js
    └── pack
        ├── footer.js
        ├── frontpage.css
        ├── frontpage.css.map
        ├── frontpage.js
        ├── head.js
        ├── modules
        │   └── styles
        │       └── blocks
        │           ├── font
        │           │   └── icons.woff
        │           └── page-footer
        │               └── slack.svg
        ├── styles.css
        ├── styles.css.map
        ├── styles.js
        └── tutorial.js

12 directories, 25 files
@liudonghua123 ➜ /workspaces/javascript.info (master) $

liudonghua123 avatar Feb 04 '24 10:02 liudonghua123

I go through the code, and find the html is rendered via pug dynamic, the render step convers a lot of processing. It's not easy to convert the markdown or embedded resources to simple static html files.

See also https://github.com/javascript-tutorial/en.javascript.info/issues/3266#issuecomment-1361156081.

liudonghua123 avatar Feb 04 '24 13:02 liudonghua123