Skip to content

breaking: Css Writer #136

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

Merged
merged 8 commits into from
Oct 19, 2020
Merged

breaking: Css Writer #136

merged 8 commits into from
Oct 19, 2020

Conversation

lukeed
Copy link
Member

@lukeed lukeed commented Oct 10, 2020

It's really a few fixes, but it since it is a change in the default behavior, safer to just call this breaking.

Doing so means we can also allow #126 to land (re: compatibility concerns) and take this opportunity to finally (!) declare useful peer dependency constraints, including Rollup@2x. (Fixing those can be a separate PR) Edit: #138

Changes

Our CSS Writer is broken. While it does work, it's not entirely useful given its environment. As of today (before this PR), the CssWriter class:

  • Completely ignores output.assetFileNames, forcing "bundle.css" as your final output, even though all other assets/chunks will/are (likely) configured to have hashed filenames.
    To go back to previous behavior, in their Rollup config, one must set assetFileNames: "[name].[ext]" or pass a function to customize the output naming format selectively.

  • Completely ignores output.sourcemap and output. sourcemapExcludeSources, which means that we force the emitted CSS files to have sourcemaps, even if we told Rollup to disable sourcemaps outright.
    To go back to previous behavior, in their Rollup config, one must set sourcemap: true – sources are included by default.

  • Always prints expanded sourcemaps (aka, multiline JSON). While super minor, there's no reason to go this with production (non-dev) output.

I included tests that ensure all these options are respected. And I made sure that when using hashed asset names (Rollup's default), that the sourcemap and CSS file correctly reference each other's hashed names.

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -64,6 +55,12 @@ interface Options {
// }
// },

/**
* Add extra code for development and debugging purposes.
Copy link
Member

Choose a reason for hiding this comment

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

I think this doesn't really add "extra code", but pretty prints the sourcemap

Copy link
Member Author

Choose a reason for hiding this comment

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

For this plugin, yes, but it's forwarded to svelte/compiler :: https://svelte.dev/docs#svelte_compile

@antony antony added this to the 7.0.0 milestone Oct 14, 2020
@lukeed lukeed merged commit 121d255 into master Oct 19, 2020
@lukeed lukeed deleted the fix/css-write branch October 19, 2020 19:31
This was referenced Oct 21, 2020
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.

3 participants