- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.7k
Closed
Description
This is a feature brought up during the attribute to class name revamp for scoped styles. It seems forgotten, so I thought it'd be nice to have an issue for it.
I was thinking that as a follow-up to this PR, maybe it could be entirely user-configurable:
const counts = {}; const incr = id => { if (!counts[id]) counts[id] = 0; return counts[id] += 1; }; const { code, css, map } = svelte.compile(source, { class: ({ name = 'svelte', filename, hash }) => `${name}-${incr(name)}` });That way we'd still get the correctness-guaranteeing behaviour (
${name}-${hash}) out of the box, but it could be set up to use incrementing in situations where it makes sense to do so (e.g. there's no SSR, or the process is controlled a la Sapper), or if people were really byte-conscious they could do something like-${hash}. Perhaps that's too much boilerplate for common cases though.
I personally think it'd be a nice addition.
Metadata
Metadata
Assignees
Labels
No labels