From 8ea3bb2631de8430e4c82d05affa20ad17cadc1a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 25 Feb 2021 12:02:51 -0500 Subject: [PATCH] pass hash function to cssHash --- src/compiler/compile/css/Stylesheet.ts | 7 ++++--- src/compiler/interfaces.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/compile/css/Stylesheet.ts b/src/compiler/compile/css/Stylesheet.ts index 312890ad0f..af8d4d9c85 100644 --- a/src/compiler/compile/css/Stylesheet.ts +++ b/src/compiler/compile/css/Stylesheet.ts @@ -275,8 +275,8 @@ class Atrule { } } -const get_default_css_hash: CssHashGetter = ({ hash }) => { - return `svelte-${hash}`; +const get_default_css_hash: CssHashGetter = ({ css, hash }) => { + return `svelte-${hash(css)}`; }; export default class Stylesheet { @@ -317,7 +317,8 @@ export default class Stylesheet { this.id = get_css_hash({ filename, name: component_name, - hash: hash(ast.css.content.styles) + css: ast.css.content.styles, + hash }); this.has_styles = true; diff --git a/src/compiler/interfaces.ts b/src/compiler/interfaces.ts index c86aed0e06..a34f932a93 100644 --- a/src/compiler/interfaces.ts +++ b/src/compiler/interfaces.ts @@ -107,7 +107,8 @@ export type ModuleFormat = 'esm' | 'cjs'; export type CssHashGetter = (args: { name: string; filename: string | undefined; - hash: string; + css: string; + hash: (input: string) => string; }) => string; export interface CompileOptions {