sveltejs / sveltejs/kit

`inlineStyleThreshold: Infinity` still copies unused css files

Open
#9,067 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

vite
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

For my understanding, when using inlineStyleThreshold: Infinity, there should be no CSS files produced in the build. But there are CSS files in _app/immutable/assets/ that are not used (because styles are inlined).

Reproduction

Create a new SvelteKit project, add inlineStyleThreshold: Infinity to the svelte config, write some css and build the project

Logs
(As example a simple web server with python, no css file is loaded)
$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [16/Feb/2023 12:06:57] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:57] "GET /_app/immutable/start-38bb7938.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:57] "GET /_app/immutable/chunks/index-7ff3c067.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:57] "GET /_app/immutable/chunks/singletons-c020755e.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:57] "GET /_app/immutable/chunks/index-2214c1cf.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/chunks/0-aa1d44d9.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/chunks/1-819452d9.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/chunks/2-daaa1281.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/chunks/_layout-44b0675e.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/components/pages/_layout.svelte-93a480e9.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/components/error.svelte-76d40913.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /_app/immutable/components/pages/_page.svelte-affe9d30.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Feb/2023 12:06:58] "GET /favicon.png HTTP/1.1" 200 -
System Info
System:
    OS: Linux 5.15 Arch Linux
  Binaries:
    Node: 19.6.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.19.2 - /usr/bin/npm
  npmPackages:
    @sveltejs/adapter-static: ^2.0.1 => 2.0.1 
    @sveltejs/kit: ^1.0.0 => 1.7.0 
    svelte: ^3.54.0 => 3.55.1 
    vite: ^4.0.0 => 4.1.1
Severity

annoyance

Additional Information

One one HTML Page, TailwindCSS, Prerender and SSR is enabled

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a new SvelteKit project using inlineStyleThreshold: Infinity, CSS, TailwindCSS, prerendering, and SSR. Inspect the generated _app/immutable/assets/ directory and the served page; done means styles are inlined without unused CSS files being copied into the build output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, tailwindcss, vite
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.