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

Rename $layout to __layout, etc #1370

Merged
merged 9 commits into from
May 7, 2021
Merged

Rename $layout to __layout, etc #1370

merged 9 commits into from
May 7, 2021

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented May 6, 2021

Closes #1149.

  • disallow files/directories with leading __, so that we can add more special files in future without breakage
  • error on $layout etc
  • create a utility for renaming files? npx @sveltejs/kit-rename-files or something?

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts

@Rich-Harris Rich-Harris marked this pull request as ready for review May 6, 2021 22:20
Copy link
Member

@Conduitry Conduitry left a comment

Choose a reason for hiding this comment

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

Amusingly, I think the __tests__.js files are now tripping the rule about not being able to start a file with two underscores unless it's one of the known ones.

@Rich-Harris
Copy link
Member Author

whoops

AFK for a bit, will fix later if no-one beats me to it

@Rich-Harris Rich-Harris merged commit b5ff7f5 into master May 7, 2021
@Rich-Harris Rich-Harris deleted the gh-1149 branch May 7, 2021 15:34
@frederikhors
Copy link
Contributor

This change makes working with Go a nightmare because of this: golang/go#43854.

Can we add a config option for this, @Rich-Harris?

@feedmeapples
Copy link

@Rich-Harris any updates on the config option?

@rohfle
Copy link

rohfle commented Oct 7, 2021

As a workaround, I added multiple paths and it worked fine with the sveltekit demo. Note the * to include paths beginning with . and _. The multiple paths are necessary because * includes these files in the immediate directory, but not in subdirectories.

//go:embed frontend/build/* frontend/build/_app/pages/* frontend/build/_app/assets/pages/*

Also note that files cannot be embedded from the parent directories of the go file where they are embedded. (no ../.. in the path)

@rohfle
Copy link

rohfle commented Dec 8, 2021

The all: path prefix for go:embed has also been recently merged in Go (https://go-review.googlesource.com/c/go/+/359413/)

cmd/go: add //go:embed all:pattern

[...]

After long discussions on #42328 and #43854, we decided to keep
the behavior of excluding . and _ files by default, but to allow the pattern
prefix 'all:' to override this default. This CL implements that change.

Note that paths like .git and com1 are still excluded, as they must be,
since they will never be packed into a module.

@frederikhors
Copy link
Contributor

@rohfle I think it will be available from 1.18, right?

@rohfle
Copy link

rohfle commented Feb 1, 2022

@frederikhors the all: path prefix is merged in 1.18beta1

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.

Change $layout.svelte to @layout.svelte and [param].svelte to {param}.svelte?
5 participants