Skip to content

BEM_UNIQUE degrades dev-time build performance #357

@chriseppstein

Description

@chriseppstein

The BEM_UNIQUE output mode purposely changes the class names associated with a block file across process restarts. The motivation behind this was to prevent people from targeting elements with those classnames with selectors that are not from a CSS Blocks file.

Unfortunately, this means that build results cannot be reliably cached across process restarts which degrades the start up time for builds. In large ember applications, this will force every handlebars template to be recompiled with every build watcher restart because there's no API to invalidate the cache of only those templates that have been ported to CSS Blocks.

Instead of randomizing per process, I propose that we randomize based on some value that changes frequently at scale but is stable from a single developer's perspective. Because caches are not portable across machines, this means that we can reliably cache build results.

Some ideas for what to use for caching:

  • The home directory of the user
  • The absolute path to where CSS Blocks is installed.
  • system uuid

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions