svelte

How to do code splitting using Svelte without Sapper

假如想象 提交于 2020-08-22 05:57:29
问题 How do you do code splitting with Svelte? (I see that you could do it using Sapper, but I don´t want to take a dependency on a node backend) 回答1: Code splitting is actually a fancy name for dynamic imports. Here's how to do it with Rollup (you'll also get killer tree-shaking in the process!). Reminder on dynamic imports: // "normal" static ES import // // - statically analytisable // - must be called at top level // - will be greedily resolved (and most often inlined) by your bundler //

给你的网站添加炫酷的动画注释

流过昼夜 提交于 2020-08-15 06:04:53
前置 rough-notation 用于在网页上创建注释并设置注释动画的小型 JavaScript 库。它还可以应用在一些常见前端框架中,比如 Vue、React、 Svelte、Angular 甚至 Web Component。我把它应用在我创建的博客园皮肤中,比如你可以看见头部导航条中的博客昵称有一个下划线。下面是它可以实现的基本效果,点击按钮试一试吧。 使用 npm install --save rough-notation 通过将元素传递到 annotation 来创建对象,以及通过配置来描述样式。拥有 annotation 对象后,可以调用 annotation.show() 显示。 import { annotate } from 'rough-notation'; const e = document.querySelector('#myElement'); const annotation = annotate(e, { type: 'underline' }); annotation.show(); 通过 Group 创建多个动画注释: import { annotate, annotationGroup } from 'rough-notation'; const a1 = annotate(document.querySelector('#e1'), {