Skip to content

Commit c87212b

Browse files
committed
Merge branch 'master' into feat/83/GoToCSSDefinition
2 parents 7f86d5c + cdefe00 commit c87212b

File tree

667 files changed

+10665
-3314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

667 files changed

+10665
-3314
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ body:
5454
attributes:
5555
label: Which package is the issue about?
5656
options:
57-
- Svelte for VS Code
58-
- language-server
57+
- Svelte for VS Code extension
58+
- svelte-language-server
5959
- svelte2tsx
6060
- svelte-check
61-
validations:
62-
required: true
6361

6462
- type: textarea
6563
id: additional-context

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v1
1010
- uses: actions/setup-node@v2
1111
with:
12-
node-version: "12.x"
12+
node-version: "16.x"
1313
cache: yarn
1414

1515
# Get projects set up
@@ -29,7 +29,7 @@ jobs:
2929
- uses: actions/checkout@v1
3030
- uses: actions/setup-node@v2
3131
with:
32-
node-version: "12.x"
32+
node-version: "16.x"
3333
cache: yarn
3434

3535
- name: Get yarn cache directory path

.github/workflows/Deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- uses: actions/setup-node@v2
1818
with:
19-
node-version: "12.x"
19+
node-version: "16.x"
2020
registry-url: "https://registry.npmjs.org"
2121
cache: yarn
2222

.github/workflows/DeploySvelte2tsxProd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: actions/setup-node@v2
1515
with:
16-
node-version: "12.x"
16+
node-version: "16.x"
1717
registry-url: "https://registry.npmjs.org"
1818
cache: yarn
1919

.github/workflows/DeploySvelteCheckProd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: actions/setup-node@v2
1515
with:
16-
node-version: "12.x"
16+
node-version: "16.x"
1717
registry-url: "https://registry.npmjs.org"
1818
cache: yarn
1919

.github/workflows/DeploySvelteLanguageServerProd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: actions/setup-node@v2
1515
with:
16-
node-version: "12.x"
16+
node-version: "16.x"
1717
registry-url: "https://registry.npmjs.org"
1818
cache: yarn
1919

.github/workflows/DeployTypescriptPluginProd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: actions/setup-node@v2
1515
with:
16-
node-version: "12.x"
16+
node-version: "16.x"
1717
registry-url: "https://registry.npmjs.org"
1818
cache: yarn
1919

docs/internal/deployment.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
### VS Code deployments
22

3-
The [publisher is Svelte](https://marketplace.visualstudio.com/manage/publishers/svelte)
3+
- The [publisher is Svelte](https://marketplace.visualstudio.com/manage/publishers/svelte)
4+
- Extension builds with a personal access token [created through one of the members](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#publishing-extensions) of that publisher which is added to [GitHub settings](https://github.com/sveltejs/language-tools/settings/secrets/actions)
5+
- Secret needs to be renewed once a year
46

5-
- Extension builds with the account signed up via GitHub from orta
7+
### Open VSV deployments
8+
9+
- The [publisher is Svelte](https://open-vsx.org/extension/svelte)
10+
- Extension builds with a personal access token [created through one of the members](https://github.com/eclipse/openvsx/blob/master/cli/README.md#publish-extensions) of that publisher which is added to [GitHub settings](https://github.com/sveltejs/language-tools/settings/secrets/actions)
611

712
### npm deployments
813

9-
- Deployments come from a bot: `svelte-language-tools-deploy`
14+
- Deployments come from a bot: `svelte-language-tools-deploy` (an account some member have access to; it could also be done through other members of the language tools team)
1015

1116
### When Deployments happen
1217

13-
- Nightly builds are triggered through a scheduled GitHub workflow every night at 04:00 UTC.
18+
- Nightly builds are triggered through a scheduled GitHub workflow every night at 04:00 UTC. (currently disabled, no plans on reenabling it)
1419
- Production builds are triggered by creating a new tag, which is best done through the "do a release" on Github. The tag name equals the version that is then shown on the marketplace, so each tag should have a higher version than the previous.

docs/preprocessors/other-css-preprocessors.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ export default { preprocess: sveltePreprocess({ postcss: true }) };
1313

1414
Note that this assumes that you have a ESM-style project, which means there's `"type": "module"` in your project's `package.json`. If not, you need to use CommonJS in your `svelte.config.js`, things like `import ...` or `export const ...` are not allowed. You then also switch the `postcss.config` `cjs` file ending to `js`.
1515

16+
If your `svelte.config.js` is not in the workspace root (for example your `svelte.config.js` is within `/frontend`), you'll have to pass in the `configFilePath` config. This is because the relative path is resolved relative to the working directory of the node process.
17+
18+
```js
19+
import sveltePreprocess from 'svelte-preprocess';
20+
import { dirname, join } from 'path';
21+
import { fileURLToPath } from 'url';
22+
23+
const __dirname = dirname(fileURLToPath(import.meta.url));
24+
25+
export default {
26+
preprocess: sveltePreprocess({
27+
postcss: {
28+
configFilePath: join(__dirname, 'postcss.config.cjs')
29+
}
30+
})
31+
};
32+
```
33+
1634
2. Either add `lang="postcss"` to each of your `<style>` tags where you plan on using PostCSS, or disable CSS diagnostics completely by adding `"svelte.plugin.css.diagnostics.enable": false` within your settings. If you still want diagnostics, install the [Stylelint VSCode extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint). If you want better syntax highlighting, install the [PostCSS VSCode extension](https://marketplace.visualstudio.com/items?itemName=csstools.postcss).
1735
1836
## TailwindCSS
@@ -24,6 +42,16 @@ To use TailwindCSS with the VSCode extension:
2442
1. Setup the `svelte.config.js` the same way you would for PostCSS - see the section above (first point) for more details
2543
2. Install the [Tailwind CSS VSCode extension](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)
2644
3. Either add `lang="postcss"` to each of your `<style>` tags where you plan on using the Tailwind CSS directives such as `@apply`, or disable CSS diagnostics completely by adding `"svelte.plugin.css.diagnostics.enable": false` within your settings. If you still want diagnostics, install the [Stylelint VSCode extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint) and [configure it accordingly](https://scottspence.com/2021/03/15/stylelint-configuration-for-tailwindcss/). Note that within your config files you can only use node-syntax, things like `import ...` or `export const ...` are not allowed. To disable css checks for `svelte-check`, use the option `--diagnostic-sources "js,svelte"`.
45+
4. If your `tailwind.config.js` is not in the workspace root. Or if your project is not in the workspace root. Make sure you pass in the path to your tailwind config file in your `postcss` [config file](https://github.com/postcss/postcss-load-config#postcssrcjs-or-postcssconfigjs).
46+
47+
```js
48+
const path = require('path');
49+
const tailwindcss = require('tailwindcss');
50+
51+
module.exports = {
52+
plugins: [tailwindcss(path.resolve(__dirname, './tailwind.config.cjs'))]
53+
};
54+
```
2755
2856
## SASS
2957

docs/preprocessors/scss-less.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,23 @@ The `node-sass` package is very sensitive to node versions. It may be possible t
8181

8282
### SCSS: Using `includePaths` does not work
8383

84-
If you use `includePaths` with relative paths, those paths will be resolved relative to the node process, not relative to the config file. So if you `svelte.config.js` is within `frontend`, the path `theme` will _NOT_ resolve to `frontend/theme` but to `<node process root>/theme` (which might be the same as `frontend`). To ensure it always resolves relative to the config file, do this (assuming a CJS-style config):
84+
If you use `includePaths` with relative paths, those paths will be resolved relative to the node process, not relative to the config file. So if you `svelte.config.js` is within `frontend`, the path `theme` will _NOT_ resolve to `frontend/theme` but to `<node process root>/theme` (which might be the same as `frontend`). To ensure it always resolves relative to the config file, do this:
85+
86+
ESM-style:
87+
88+
```js
89+
import sveltePreprocess from 'svelte-preprocess';
90+
import { dirname, join } from 'path';
91+
import { fileURLToPath } from 'url';
92+
93+
const __dirname = dirname(fileURLToPath());
94+
95+
export default {
96+
preprocess: sveltePreprocess({ includePaths: [join(__dirname, 'relative/path')] })
97+
};
98+
```
99+
100+
CJS-style:
85101

86102
```js
87103
const sveltePreprocess = require('svelte-preprocess');
@@ -91,3 +107,38 @@ module.exports = {
91107
preprocess: sveltePreprocess({ includePaths: [path.join(__dirname, 'relative/path')] })
92108
};
93109
```
110+
111+
### SCSS: Can't find stylesheet when using `prependData`
112+
113+
Same as the problem with the `includePaths`, the file path in the prependData option also has to be resolved relative to the node process.
114+
115+
ESM-style:
116+
117+
```js
118+
import sveltePreprocess from 'svelte-preprocess';
119+
import { dirname, join } from 'path';
120+
import { fileURLToPath } from 'url';
121+
122+
const __dirname = dirname(fileURLToPath(import.meta.url));
123+
124+
export default {
125+
preprocess: sveltePreprocess({
126+
prependData: `@import '${join(__dirname, 'src/to/variable.scss').replace(/\\/g, '/')}';`
127+
})
128+
};
129+
```
130+
131+
CJS-style:
132+
133+
```js
134+
const sveltePreprocess = require('svelte-preprocess');
135+
const path = require('path');
136+
137+
module.exports = {
138+
preprocess: sveltePreprocess({
139+
prependData: `@import '${path
140+
.join(__dirname, 'src/to/variable.scss')
141+
.replace(/\\/g, '/')}';`
142+
})
143+
};
144+
```

0 commit comments

Comments
 (0)