Skip to content

Releases: mayank99/ecsstatic

v0.8.0

04 Feb 01:12
Compare
Choose a tag to compare
  • Removed CJS support; this package is now pure ESM.
  • Bumped all deps, including esbuild, postcss and vite.
  • Updated license.

v0.7.0

19 May 02:49
Compare
Choose a tag to compare
  • Added support for global (unscoped) styles though the new createGlobalStyle function. This should only be used when it's not possible to use a .css/.scss file, such as when interpolating JS expressions.
    import { createGlobalStyle } from '@acab/ecsstatic';
    
    createGlobalStyle`
      :root {
        --foo: ${1 + 1};
      }
    `;
  • Moved the scss function from root into a subpath /scss and renamed it to css. This will result in out-of-the-box support for syntax highlighting without resorting to any renaming hacks,
    - import { scss as css } from '@acab/ecsstatic';
    + import { css } from '@acab/ecsstatic/scss';
  • Fixed an issue where styles were left behind in <head> after HMR
  • Bumped deps

Full Changelog: v0.6.1...v0.7.0

v0.6.1

18 May 00:40
Compare
Choose a tag to compare

Fixed an issue where interpolating other classes returned by ecsstatic was generating incorrect output (#16).

v0.6.0

19 Feb 20:31
Compare
Choose a tag to compare

postcss-nesting is now more strictly following the CSS nesting spec, which means certain syntaxes would break. To work around this, ecsstatic will run postcss-nested after postcss-nesting, thus allowing these nonconformant syntaxes to continue to work like they would in Sass.

const foo = css`
  animation: blinky 2s;

  /* nesting elements like this is not allowed in the spec, but will work in ecsstatic */
  span {
    color: hotpink;
  }

  /* same with @keyframes and @font-face */
  @keyframes blinky {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
`;

This behavior should be more predictable during the transition period, as official nesting starts making its way into all browsers and developers start getting used to it.

For more details, see #12

v0.5.1

15 Feb 00:26
Compare
Choose a tag to compare

Fixed an issue where expressions were not being evaluated when using tsconfig path aliases.

v0.5.0

12 Feb 21:40
Compare
Choose a tag to compare

Replaced postcss-nested with postcss-nesting which follows the recently reworked specification. This should fix issues with nesting newer rules like @container.

This only affects the css function, as scss has its own version of nesting.

v0.4.0

11 Feb 01:11
Compare
Choose a tag to compare

Added the ability to automatically optimize the prod build into atomic/utility classes, where one class maps to one declaration. This can potentially result in a smaller CSS file, at the cost increasing the HTML size. Dev build is unaffected, for a better debugging experience.

To enable this optimization, use the experimental marqueeMode flag.

export default defineConfig({
  plugins: [ecsstatic({ marqueeMode: true })],
});

This mode is only recommended for very large sites where the size of the CSS would be legitimately be a concern, and even then, it is highly recommended to do your own measurements with and without this flag to see if it actually makes a meaningful impact.

For more details, see #6

v0.3.1

06 Feb 03:43
Compare
Choose a tag to compare

Fixed an issue where vite build --watch would result in errors when rebuilding.

v0.3.0

29 Jan 21:31
Compare
Choose a tag to compare

This release includes two new experimental features 🎈

  • New classNamePrefix option to allow customizing the prefix for hashed class names.
  • Support for using css in .astro files (frontmatter only).

That means you can now do this in your config:

plugins: [ecsstatic({ classNamePrefix: 'poop' })]

and use it in an astro file:

---
import { css } from '@acab/ecsstatic';
const heading = css`
  color: hotpink;
`;
---
<h1 class={heading}>Hello</h1>

which will output:

<h1 class='poop-1bh9win'>Hello</h1>
.poop-1bh9win {
  color: hotpink;
}

While this in itself is not very useful (because astro already has scoped styles), a more interesting use case is when you need to import styles already defined in a different .ts/.js file.

---
import { heading } from '../shared/styles.js';
---
<h1 class={heading}>Hello</h1>

Also, there is one breaking change: the evaluateExpressions option has been removed. This hopefully shouldn't affect anyone because its default value was true, and it had no effect when the template strings didn't contain interpolated expressions.

v0.2.0

25 Jan 06:44
Compare
Choose a tag to compare
  • In dev mode, the classes in the markup will now contain the name of the original variable if available. These classes are unused in the CSS but will make it easier to find the right element in browser dev tools.
     // input
     const Button = () => <button class={button}>hi</button>
     const button = css`
       display: grid;
       place-items: center;
     `;
     // output
     <button class="🎈-button 🎈-rvaw9y">hi</button>
     /* output */
     .🎈-rvaw9y {
       display: grid;
       place-items: center;
     }
  • Improved compatibility with npm packages when evaluating expressions. ESM packages should now work out of the box instead of requiring to be passed to resolvePackages.