New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@6edesign/svelte-router

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@6edesign/svelte-router

page.js based router for svelte

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-84.62%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-router

A little router component that uses code splitting for components. Uses page.js (~2kb min/gzip) for routing.

A Work in Progress:

I'm not entirely sure this is useful yet and it has not been published to NPM at this time.

How to use:

With Svelte v3:

<script>
 import { Router, Route } from '6edesign/svelte-router';
</script>

<div>
  <Router>
    <!-- Route paths can be strings (exact matches or express-style named-params) or regex -->
    <!-- componentImport is a function which dynamically imports the necessary component -->
    <Route 
      path='/' 
      componentImport={() => import('./HomeRoute.svelte')} 
    />
    <Route 
      path={/\/regex-route\.(\d+)/} 
      componentImport={() => import('./RegexRoute.svelte')} 
    />
    <Route 
      path='/named/:id'
      componentImport={() => import('./NamedParamsRoute.svelte')} 
    />
 </Router>
</div>

(Minimal) Rollup Config Example:

import svelte from "rollup-plugin-svelte";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import { terser } from "rollup-plugin-terser";

const test = {
  input: "src/app.js",
  output: {
    sourcemap: true,
    format: "es",
    dir: 'public/module'
  },
  experimentalCodeSplitting: true, 
  plugins: [
    svelte({
      nestedTransitions: true,
      dev: false,
      css: css => {
        css.write("public/app.css");
      }
    }),
    resolve(),
    commonjs()
  ]
};

export default [test];

Contributing to this project

Clone & install the dependencies...

cd svelte-router
npm install

...then start Rollup:

npm run dev

Keywords

FAQs

Package last updated on 17 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc