Skip to content

Conversation

PuruVJ
Copy link
Collaborator

@PuruVJ PuruVJ commented Apr 3, 2023

This moves all code snippets to imports rather than the current require. Only exception is svelte/register

@vercel
Copy link

vercel bot commented Apr 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 8:59pm

@PuruVJ PuruVJ changed the base branch from master to sites April 3, 2023 19:25
@PuruVJ PuruVJ marked this pull request as draft April 3, 2023 19:26
const svelte = require('svelte/compiler');
const sass = require('node-sass');
import svelte from 'svelte/compiler';
import sass from 'node-sass';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe update this to use dart-sass? Recommending something as obnoxious as node-sass can't be a good impression

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what svelte-preprocess does, so I guess it wouldn't hurt to change for consistency: https://github.com/sveltejs/svelte-preprocess/blob/537b97536c2a48574ca748dccf3fcc0dc6d3ffc5/src/transformers/scss.ts

Copy link
Collaborator Author

@PuruVJ PuruVJ Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

svelte preprocess uses a deprecated API of sass, so I tested on staclkblitz with new compileStringAsync API, works, so gonna keep that here https://stackblitz.com/edit/node-ncrbch?file=index.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you should send it as a PR to svelte-preprocess as well 😄

@PuruVJ PuruVJ marked this pull request as ready for review April 3, 2023 19:30

The `script` and `style` functions receive the contents of `<script>` and `<style>` elements respectively (`content`) as well as the entire component source text (`markup`). In addition to `filename`, they get an object of the element's attributes.

If a `dependencies` array is returned, it will be included in the result object. This is used by packages like [rollup-plugin-svelte](https://github.com/sveltejs/rollup-plugin-svelte) to watch additional files for changes, in the case where your `<style>` tag has an `@import` (for example).
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about vite-plugin-svelte?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benmccann benmccann merged commit beb3f65 into sites Apr 3, 2023
@benmccann benmccann deleted the feat/cjs-to-esm-code-examples branch April 3, 2023 22:29
@gtm-nayan gtm-nayan mentioned this pull request Jun 17, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants