Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site v3 Api Docs - SASS example typo #2337

Closed
cvlab opened this issue Mar 29, 2019 · 0 comments · Fixed by #2346
Closed

Site v3 Api Docs - SASS example typo #2337

cvlab opened this issue Mar 29, 2019 · 0 comments · Fixed by #2346

Comments

@cvlab
Copy link
Contributor

cvlab commented Mar 29, 2019

2 hours ago in this link was the new version of docs, now is older. I'm not sure if it's relevant now.

There is SASS example that contains a few typos. +async -)

const svelte = require('svelte/compiler');
const sass = require('node-sass');
const { dirname } = require('path');

const { code, dependencies } = svelte.preprocess(source, {
	style: async ({ content, attributes, filename }) => {
		// only process <style lang="sass">
		if (attributes.lang !== 'sass') return;

		const { css, stats } = await new Promise((resolve, reject) => sass.render({
			file: filename,
			data: content,
			includePaths: [
				dirname(filename),
			],
		}, (err, result) => {
			if (err) reject(err);
			else resolve(result);
		}));

		return {
			code: css.toString(),
			dependencies: stats.includedFiles
		};
	}
}, {
	filename: 'App.svelte'
});
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 a pull request may close this issue.

1 participant