roxiness / stackmix

A collection of templates for Routify.
22 stars 2 forks source link

Question about default template #24

Closed Wolfr closed 3 years ago

Wolfr commented 3 years ago

I chose the scroll template. In the default _layout.svelte I found some odd code. What's with the lines only containing ';'? Is this autogenerated from something?

<script>
  import { components, beforeUrlChange, layout, page, url } from "@roxi/routify";
  ;

  ;

  ;

  ;

  // we want smooth scrolling when navigating (hash links) within the same page
  $beforeUrlChange(
    (event, newRoute) => (document.documentElement.style["scrollBehavior"] = newRoute === $page ? "smooth" : "auto")
  );

  ;
</script>
jakobrosenberg commented 3 years ago

Those shouldn't be there, but yes, they're generated from different fragments.

Good catch btw. This is the culprit

<script>
  import { components, beforeUrlChange, layout, page, url } from "@roxi/routify";
  __SCRIPT__;

  __IMPORTS__;

  __CONSTANTS__;

  __LOGIC__;

  // we want smooth scrolling when navigating (hash links) within the same page
  $beforeUrlChange(
    (event, newRoute) => (document.documentElement.style["scrollBehavior"] = newRoute === $page ? "smooth" : "auto")
  );

  __FUNCTIONS__;
</script>

Obviously there shouldn't be semi colons. I better check the linters.

jakobrosenberg commented 3 years ago

This has been fixed now.