Skip to content

Pug compiler "spills out" of the context of <template> tag #211

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

Closed
jakubferenc opened this issue Aug 4, 2020 · 2 comments
Closed

Pug compiler "spills out" of the context of <template> tag #211

jakubferenc opened this issue Aug 4, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jakubferenc
Copy link
Contributor

jakubferenc commented Aug 4, 2020

Describe the bug
Using the basic example of both Svelte and svelte-preprocess in their docs, I set up only the pug preprocessor to process in my App.svelte file. However, the content inside the template tag is not processed, but everything outside the template tag is processed via the pug preprocessor.

To Reproduce

  • download the basic Svelte example repo
  • set up the basic svelte-preprocess example in rollup.config.js with
    import { pug } from 'svelte-preprocess';
		svelte({
			// enable run-time checks when not in production
			dev: !production,
			// we'll extract any component CSS out into
			// a separate file - better for performance
			
			preprocess: [
				pug(),
			],
			css: css => {
				css.write('public/build/bundle.css');
			}
		}),

In my App.svelte file I have a following simple code:

<template lang="pug">
	h1 testing h1 inside template tag
</template>

h2 testing h2 outside template tag

In the browser, only the "testing h2 outside template tag" is seen and styled as h2. Thus implying that the pug compiler ignores the tag and preprocesses outside of it.

Expected behavior
The pug compiler should compile only within the context of tag

Information about your project:

  • mac OS Catalina
  • svelte-preprocess version 4.0.10
  • Rollup

@kaisermann
Copy link
Member

Hey @jakubferenc 👋 The.<template> wrapper feature is only available if you use the automatic preprocessor (see the note here). If you want to use the standalone pug preprocessor, you need to write your whole component in pug

@kaisermann kaisermann self-assigned this Aug 18, 2020
@kaisermann
Copy link
Member

Forget that, added it to v4.1.0 🎉

@kaisermann kaisermann added the enhancement New feature or request label Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants