Use this guide to migrate your project from Doks v1 to Doks v2.

Prerequisites

Updating

Follow the steps below to update your project.

  1. Remove currently installed dependencies to avoid version conflicts:

  2. Update package.json

    Replace the contents of your project’s package.json with the following template:

    {
      "name": "doks",
      "version": "0.0.0",
      "description": "Doks theme",
      "author": "Thulite",
      "license": "MIT",
      "scripts": {
        "create": "hugo new",
        "dev": "hugo server --disableFastRender --noHTTPCache",
        "portless": "portless run thulite-portless",
        "format": "prettier **/** -w -c",
        "build": "hugo --minify --gc",
        "preview": "vite preview --outDir public"
      },
      "engines": {
        "node": ">=20.11.0"
      }
    }
  3. Install the latest Thulite and Doks dependencies in your project:

  4. Install the latest versions of Portless, Prettier, and Vite as devDependencies:

  5. Install the recommended integrations in your project:

  6. Add the following to layouts/_partials/head/dartsass.html:

    {{- /* Transpile SCSS with Dart Sass and silence legacy dependency warnings. */ -}}
    {{ with resources.Get . -}}
      {{ $opts := dict
        "enableSourceMap" hugo.IsDevelopment
        "outputStyle" (cond hugo.IsDevelopment "expanded" "compressed")
        "transpiler" "dartsass"
        "includePaths" (slice "node_modules")
        "silenceDeprecations" (slice "import" "if-function" "global-builtin" "color-functions")
        "silenceDependencyDeprecations" true
      -}}
      {{ with . | css.Sass $opts -}}
        {{ if hugo.IsDevelopment -}}
          <link rel="stylesheet" href="{{ .RelPermalink }}">
        {{ else -}}
          {{/* PostProcess defers PostCSS until hugo_stats.json is complete. */ -}}
          {{ with . | postCSS (dict "config" "config/postcss.config.js") | fingerprint | resources.PostProcess -}}
            <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
          {{ end -}}
        {{ end -}}
      {{ end -}}
    {{ end -}}

Need to continue?

After upgrading Doks to the latest version, you may not need to make any changes to your project at all!

If you notice errors or unexpected behavior, review the sections below to identify project changes you may still need to make.

Configuration

Review your project configuration for Doks, Thulite, and the recommended integrations:

Known Issues

ENOENT

If you get an ENOENT error, run the following command: