Skip to content

Documentation on custom JavaScript is outdated and no longer works #5326

@fabianlupa

Description

@fabianlupa

Theme version and system environment

  • Minimal Mistakes version: 4.27.3
  • Ruby gem or remote theme version: Ruby Gem
  • Jekyll version: 4.4.1
  • Git repository URL: irrelevant
  • URL to the page with the problem: irrelevant
  • Operating system: Docker on macOS
  • Browser version: irrelevant

What happened?

I changed the header bar to be sticky in a custom scss file and all is working fine except for navigation to anchor links. The title scrolls behind the now sticky header bar. After some troubleshooting I noticed none of the normal CSS trickery to adjust this works as scrolling is handling by an onclick handler using SmoothScroll. SmoothScroll is initialized and configured here:

var scroll = new SmoothScroll('a[href*="#"]', {
offset: 20,
speed: 400,
speedAsDuration: true,
durationMax: 500,
});

I want to change the offset value to account for the now sticky header bar. As there seems to be no configuration available in the theme I attempted to override the _main.js using the guide here: https://mmistakes.github.io/minimal-mistakes/docs/javascript/#customizing

It no longer works though. After some more troubleshooting I found out that in 0b8b523 the npm-based script to build the JavaScript files has been moved to a rakefile causing the npm run build:js command from the documentation to no longer work.

I am unsure how I can implement my adjustments to SmoothScroll configuration.

Expected behavior

The documentation on https://mmistakes.github.io/minimal-mistakes/docs/javascript/#customizing should correctly reflect the current state of development.

Steps to reproduce the behavior

Follow the steps on https://mmistakes.github.io/minimal-mistakes/docs/javascript/#customizing and get an error message on npm run build:js

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions