fix prefix generation and test cases

pull/4740/head
§Domenik Reitzner 6 years ago
parent 1c2cf7e52b
commit e84b4aca92

@ -26,7 +26,8 @@ const valid_options = [
'css', 'css',
'loopGuardTimeout', 'loopGuardTimeout',
'preserveComments', 'preserveComments',
'preserveWhitespace' 'preserveWhitespace',
'prefix',
]; ];
function validate_options(options: CompileOptions, warnings: Warning[]) { function validate_options(options: CompileOptions, warnings: Warning[]) {

@ -2,7 +2,7 @@ export default function get_prefix(str?: string): string {
const standard_prefix = 'svelte-'; const standard_prefix = 'svelte-';
if (!str if (!str
|| typeof str !== 'string') return standard_prefix; || typeof str !== 'string') return standard_prefix;
str = str.replace(/^[^_-a-z]+|[^_-a-z0-9]/gi, ''); str = str.replace(/^[^_\-a-z]+|[^_\-a-z0-9]/gi, '');
return str.length return str.length
? str ? str
: standard_prefix; : standard_prefix;

@ -1 +1 @@
div.svelte-xyz{color:blue} div.svelte-1tjtw78{color:blue}

@ -1 +1 @@
div.me-xyz{color:blue} div.me-1tjtw78{color:blue}

@ -1 +1 @@
div.me-xyz{color:blue} div.me-1tjtw78{color:blue}

@ -1 +1 @@
div.svelte-xyz{color:blue} div.svelte-1tjtw78{color:blue}

@ -1 +1 @@
div.me-xyz{color:blue} div.me-1tjtw78{color:blue}

@ -1 +1 @@
div.me-xyz{color:blue} div.me-1tjtw78{color:blue}

@ -1 +1 @@
div.me-xyz{color:blue} div.me-1tjtw78{color:blue}
Loading…
Cancel
Save