Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The behavior of glob() was changed in 2.1.11. #496

Open
iorate opened this issue Oct 28, 2022 · 0 comments
Open

The behavior of glob() was changed in 2.1.11. #496

iorate opened this issue Oct 28, 2022 · 0 comments

Comments

@iorate
Copy link

iorate commented Oct 28, 2022

In goober <=2.1.10, repetitive calls to glob() append CSS.
In contrast, in 2.1.11, repetitive calls to glob() replace CSS.

<script type="module">
  import { glob } from 'https://esm.sh/[email protected]';

  glob`body { color: red; }`;
  glob`body { font-weight: bold; }`;

  document.body.textContent = window._goober.textContent;

  // 2.1.11
  // body{font-weight:bold;}

  // 2.1.10
  // body{color:red;}body{font-weight:bold;}
</script>

I understand #484 is a necessary change for createGlobalStyles(), but I would like the behavior of glob() to remain the same because I have a hard dependency on it.

Possible update:

// css.js
let glob = css.bind({ g: 1, legacyGlob: 1 });

function css(val) {
  // ...
  return hash(
    // ...
    ctx.legacyGlob
  );
}

// core/hash.js
export let hash = (compiled, sheet, global, append, keyframes, legacyGlob) => {
  // ...
  let cssToReplace = global && !legacyGlob && cache.g ? cache.g : null;
  // ...
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant