chore(js): Unbundle assets in Hugo development and testing environments:
- Keep assets unbundled for easier debugging in development and testing. - Copies other config from development to testing.pull/6079/head
parent
c43df7508f
commit
13129c5687
|
@ -41,7 +41,7 @@ jobs:
|
|||
- /home/circleci/bin
|
||||
- run:
|
||||
name: Hugo Build
|
||||
command: npx hugo --logLevel info --minify --destination workspace/public
|
||||
command: npx hugo --config config/production/config.yml --logLevel info --minify --destination workspace/public
|
||||
- persist_to_workspace:
|
||||
root: workspace
|
||||
paths:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# Production overrides for CI/CD builds
|
||||
baseURL: 'https://docs.influxdata.com/'
|
||||
|
||||
# Production environment parameters
|
||||
params:
|
||||
env: production
|
||||
environment: production
|
||||
|
||||
# Enable minification for production
|
||||
minify:
|
||||
disableJS: false
|
||||
disableCSS: false
|
||||
disableHTML: false
|
||||
minifyOutput: true
|
||||
|
||||
# Production asset processing
|
||||
build:
|
||||
writeStats: false
|
||||
useResourceCacheWhen: "always"
|
||||
buildOptions:
|
||||
sourcemap: false
|
||||
target: "es2015"
|
||||
|
||||
# Disable development server settings
|
||||
server: {}
|
|
@ -1,16 +1,36 @@
|
|||
baseURL: 'http://localhost:1315/'
|
||||
languageCode: en-us
|
||||
title: InfluxDB Documentation
|
||||
|
||||
server:
|
||||
port: 1315
|
||||
# Git history information for lastMod-type functionality
|
||||
enableGitInfo: true
|
||||
|
||||
# Syntax Highlighting
|
||||
pygmentsCodefences: true
|
||||
pygmentsUseClasses: true
|
||||
|
||||
# Preserve case in article tags
|
||||
preserveTaxonomyNames: true
|
||||
|
||||
# Generate a robots.txt
|
||||
enableRobotsTXT: true
|
||||
|
||||
# Override settings for testing
|
||||
buildFuture: true
|
||||
|
||||
# Configure what content is built in testing env
|
||||
params:
|
||||
env: testing
|
||||
environment: testing
|
||||
buildTestContent: true
|
||||
|
||||
# Server configuration for testing
|
||||
server:
|
||||
port: 1315
|
||||
baseURL: 'http://localhost:1315/'
|
||||
watchChanges: true
|
||||
disableLiveReload: false
|
||||
|
||||
# Keep your shared content exclusions
|
||||
ignoreFiles:
|
||||
- "content/shared/.*"
|
||||
|
@ -18,3 +38,74 @@ ignoreFiles:
|
|||
# Ignore specific warning logs
|
||||
ignoreLogs:
|
||||
- warning-goldmark-raw-html
|
||||
|
||||
# Markdown rendering options
|
||||
blackfriday:
|
||||
hrefTargetBlank: true
|
||||
smartDashes: false
|
||||
|
||||
# Copy taxonomies from main config
|
||||
taxonomies:
|
||||
influxdb/v2/tag: influxdb/v2/tags
|
||||
influxdb/cloud/tag: influxdb/cloud/tags
|
||||
influxdb3/cloud-serverless/tag: influxdb/cloud-serverless/tags
|
||||
influxdb3/cloud-dedicated/tag: influxdb/cloud-dedicated/tags
|
||||
influxdb3/clustered/tag: influxdb3/clustered/tags
|
||||
influxdb3/core/tag: influxdb3/core/tags
|
||||
influxdb3/enterprise/tag: influxdb3/enterprise/tags
|
||||
flux/v0/tag: flux/v0/tags
|
||||
|
||||
# Markup configuration
|
||||
markup:
|
||||
goldmark:
|
||||
renderer:
|
||||
unsafe: true
|
||||
extensions:
|
||||
linkify: false
|
||||
parser:
|
||||
attribute:
|
||||
block: true
|
||||
|
||||
# Privacy settings
|
||||
privacy:
|
||||
googleAnalytics:
|
||||
anonymizeIP: false
|
||||
disable: false
|
||||
respectDoNotTrack: true
|
||||
useSessionStorage: false
|
||||
youtube:
|
||||
disable: false
|
||||
privacyEnhanced: true
|
||||
|
||||
# Output formats
|
||||
outputFormats:
|
||||
json:
|
||||
mediaType: application/json
|
||||
baseName: pages
|
||||
isPlainText: true
|
||||
|
||||
# Asset processing for testing (disable minification)
|
||||
build:
|
||||
writeStats: true
|
||||
useResourceCacheWhen: "fallback"
|
||||
buildOptions:
|
||||
sourcemap: "inline"
|
||||
target: "es2020"
|
||||
|
||||
# Disable minification for testing
|
||||
minify:
|
||||
disableJS: true
|
||||
disableCSS: true
|
||||
disableHTML: true
|
||||
minifyOutput: false
|
||||
|
||||
# Asset processing configuration
|
||||
assetDir: "assets"
|
||||
|
||||
# Module mounts
|
||||
module:
|
||||
mounts:
|
||||
- source: assets
|
||||
target: assets
|
||||
- source: node_modules
|
||||
target: assets/node_modules
|
|
@ -17,7 +17,26 @@ enableRobotsTXT: true
|
|||
|
||||
# Custom staging params
|
||||
params:
|
||||
env: staging
|
||||
environment: staging
|
||||
server:
|
||||
disableLiveReload: true
|
||||
|
||||
# Staging uses the same asset processing as production
|
||||
# Enable minification for staging
|
||||
minify:
|
||||
disableJS: false
|
||||
disableCSS: false
|
||||
disableHTML: false
|
||||
minifyOutput: true
|
||||
|
||||
# Staging asset processing
|
||||
build:
|
||||
writeStats: false
|
||||
useResourceCacheWhen: "always"
|
||||
buildOptions:
|
||||
sourcemap: false
|
||||
target: "es2015"
|
||||
|
||||
# Markdown rendering options
|
||||
blackfriday:
|
||||
|
|
29
hugo.yml
29
hugo.yml
|
@ -55,10 +55,16 @@ outputFormats:
|
|||
baseName: pages
|
||||
isPlainText: true
|
||||
|
||||
# Asset processing configuration for development
|
||||
build:
|
||||
# Configure JavaScript build settings for ES6 modules
|
||||
writeStats: true
|
||||
useResourceCacheWhen: "fallback"
|
||||
# Enable source maps for debugging
|
||||
buildOptions:
|
||||
sourcemap: "inline"
|
||||
target: "es2020"
|
||||
# Disable asset bundling in development
|
||||
noJSConfigInAssets: false
|
||||
|
||||
# Asset processing configuration
|
||||
assetDir: "assets"
|
||||
|
@ -70,11 +76,22 @@ module:
|
|||
- source: node_modules
|
||||
target: assets/node_modules
|
||||
|
||||
# Ensure proper JavaScript processing in development
|
||||
minify:
|
||||
disableJS: true
|
||||
minifyOutput: false
|
||||
|
||||
# Development settings
|
||||
params:
|
||||
env: development
|
||||
environment: development
|
||||
|
||||
# Configure the server for development
|
||||
# Specify the port for development to avoid conflicts with testing
|
||||
server:
|
||||
port: 1313
|
||||
baseURL: 'http://localhost:1313/'
|
||||
watchChanges: true
|
||||
disableLiveReload: false
|
||||
|
||||
# Disable minification and bundling for development
|
||||
minify:
|
||||
disableJS: true
|
||||
disableCSS: true
|
||||
disableHTML: true
|
||||
minifyOutput: false
|
||||
|
|
|
@ -12,7 +12,45 @@
|
|||
{{ end -}}
|
||||
{{ $products := .Site.Data.products }}
|
||||
{{ $influxdb_urls := .Site.Data.influxdb_urls }}
|
||||
<!-- Build index.js -->
|
||||
|
||||
{{ $isDevelopmentOrTesting := or (eq .Site.Params.environment "development") (eq .Site.Params.environment "testing") (eq (getenv "HUGO_ENV") "development") (eq (getenv "HUGO_ENV") "testing") (not hugo.IsProduction) }}
|
||||
|
||||
{{ if $isDevelopmentOrTesting }}
|
||||
{{/* Load individual JS files for debugging */}}
|
||||
{{ $sharedParams := dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls }}
|
||||
|
||||
{{/* Load main.js first to ensure proper initialization */}}
|
||||
{{ with resources.Get "js/main.js" }}
|
||||
{{ $opts := dict
|
||||
"minify" false
|
||||
"sourceMap" "inline"
|
||||
"targetPath" "js/main.js"
|
||||
"params" $sharedParams
|
||||
}}
|
||||
{{ with . | js.Build $opts }}
|
||||
<script defer src="{{ .RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Load other individual JS files for debugging */}}
|
||||
{{ range $file := (readDir "assets/js") }}
|
||||
{{ if and (strings.HasSuffix $file.Name ".js") (ne $file.Name "main.js") }}
|
||||
{{ $jsPath := printf "js/%s" $file.Name }}
|
||||
{{ with resources.Get $jsPath }}
|
||||
{{ $opts := dict
|
||||
"minify" false
|
||||
"sourceMap" "inline"
|
||||
"targetPath" $jsPath
|
||||
"params" $sharedParams
|
||||
}}
|
||||
{{ with . | js.Build $opts }}
|
||||
<script defer src="{{ .RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{/* Non-development environment: Bundle everything */}}
|
||||
{{ with resources.Get "js/main.js" }}
|
||||
{{ $opts := dict
|
||||
"minify" hugo.IsProduction
|
||||
|
@ -30,3 +68,4 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
Loading…
Reference in New Issue