mirror of https://github.com/sveltejs/svelte
add cssHash option (#6026)
* Allow to customize the css scope class * Pass component name to scope class generator * Move Stylesheet arguments into an object * Refactor to cssHash * Please the almighty linter * pass hash function to cssHash * update test * document cssHash option Co-authored-by: Christian Kaisermann <christian@kaisermann.me>pull/6029/head
parent
5c8807e523
commit
2925a00eff
@ -0,0 +1,12 @@
|
||||
export default {
|
||||
compileOptions: {
|
||||
filename: 'src/components/FooSwitcher.svelte',
|
||||
cssHash({ hash, css, name, filename }) {
|
||||
const minFilename = filename
|
||||
.split('/')
|
||||
.map(i => i.charAt(0).toLowerCase())
|
||||
.join('');
|
||||
return `sv-${name}-${minFilename}-${hash(css)}`;
|
||||
}
|
||||
}
|
||||
};
|
@ -0,0 +1 @@
|
||||
div.sv-FooSwitcher-scf-bzh57p{color:red}
|
@ -0,0 +1,7 @@
|
||||
<div>red</div>
|
||||
|
||||
<style>
|
||||
div {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue