css-modules VS stencil

Compare css-modules vs stencil and see what are their differences.

css-modules

Documentation about css-modules (by css-modules)

stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase. (by ionic-team)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
css-modules stencil
84 55
17,327 12,243
1.4% 0.8%
5.5 9.9
5 days ago 3 days ago
TypeScript
- GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

css-modules

Posts with mentions or reviews of css-modules. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-01-22.
  • Use TailwindCSS prefixes for shared design system components
    6 projects | dev.to | 22 Jan 2024
    For many years, Culture Amp took the second option, and distributed shared components without compiled CSS. This meant that every app that consumed shared components needed to include the necessary CSS build tooling – at that time CSS Modules and node-sass – with a compatible version and configuration. This was relatively easy to set up, but over time proved difficult to maintain. When node-sass was deprecated in favour of (the much faster but slightly incompatible) Dart Sass, this demanded a difficult lock-step migration across all those codebases, which we have yet to achieve. And as new applications have switched to Tailwind for their own styles, they've had to continue to maintain those old build tools in parallel for the shared components' styles.
  • CSS Modules Still a Thing?
    2 projects | /r/css | 7 Dec 2023
    So CSS modules are a form of 3rd-party CSS-in-JS, where what you import are the class names, which are then usually obfuscated etc at compile time, and all the actual style declarations are (usually) compiled into a single css file or tag as part of the bundling process. You can read the og docs on'em here, and you've probably seen'em used in React like:

    import styles from "./styles.css";
    
    function Example(){
        return (
            

    Hello

    ); }

    They predate the ability to import non-js files in vanilla by a good while, and rely on the compile process to translate your .css files into .js files that can be imported using whichever loader you use in your bundler.

    Import assertions are a vanilla way to import non-js files by telling the browser how to import them; assert { type: "css" } says to treat the file as CSS and create a CSSStyleSheet, assert { type: "json" } says to treat the file as JSON and create a JSON object - and hopefully assert { type: "html" } will hopefully arrive soon and create a #document-fragment or something similar.

    Hope that clears it up!

  • An Overview of 25+ UI Component Libraries in 2023
    40 projects | dev.to | 10 Sep 2023
    Extensions of CSS: for example, Sass, Less, Tailwind, CSS Modules, to make stuff look a certain way on your own.
  • Creating a Component Library Fast🚀(using Vite's library mode)
    7 projects | dev.to | 11 Aug 2023
    The components are styled with CSS modules. When building the library, these styles will get transformed to normal CSS style sheets. This means that the consuming application will not even be required to support CSS modules. (In the future I want to extend this tutorial to use vanilla-extract instead.)
  • All 7 ways to deal with CSS most never tried
    5 projects | dev.to | 7 Jun 2023
    NextJS comes with built-in support for CSS Modules which allows you to scope your styles locally in individual components without worrying about name collisions or messing up other parts of the codebase.
  • Vanilla+PostCSS as an Alternative to SCSS
    15 projects | dev.to | 30 Mar 2023
    CSS modules are not to be confused with mixins, as they serve the opposite purpose. While mixins are components or functions to be reused globally, modules are style sheets with a local scope used in a similar way as styled components in React.
  • The Future of CSS
    7 projects | dev.to | 9 Feb 2023
    CSS Modules CSS Modules is a pre-processing step: by default, styles are scoped locally to the current component, and the transpiler ensures no conflicts.
  • CSS Style Guide for Web Dev?
    5 projects | /r/learnprogramming | 30 Jan 2023
    But if you don’t want to use any of those yet, I would suggest at least using CSS modules to scope styling to components.
  • Why is tailwind so hyped?
    7 projects | /r/webdev | 13 Jan 2023
    Have you seen/tried CSS Modules? It's built into CRA and Vite, and it lets you write styles that are scoped to the component. I've heard people talk about using them alongside Tailwind, so I don't think it's necessarily an either/or situation, but to me it feels a lot more natural.
  • CSS: From Chaos to Order
    4 projects | dev.to | 29 Dec 2022
    You probably know what css-loader is and how it allows you to work with CSS modules. If this is not the case, then let me remind you what it is using the example of a React component:

stencil

Posts with mentions or reviews of stencil. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-14.
  • Ajout de l'auto-complétion sur les Web Components avec Stencil
    5 projects | dev.to | 14 Mar 2024
  • Making Web Component properties behave closer to the platform
    9 projects | dev.to | 21 Jan 2024
    First a disclosure: I never actually used Stencil, only played with it a bit locally in a hello-world project while writing this post.
  • Plasmic.app – the visual builder for your tech stack
    9 projects | news.ycombinator.com | 19 Dec 2023
    This is my main concern too.

    I don't understand why tools like this "pick a winner" with a specific framework instead of rendering to Web Components with a framework wrapper, or using something like Stencil[1] that can render to any framework.

    [1] https://stenciljs.com/

  • Design Systems with Web Components
    5 projects | dev.to | 18 Dec 2023
    I was recently able to sit down with some of the core members of Ionic, who also created Stencil a toolchain for building Design Systems and Progressive Web Apps. We talked at great length how typically companies are approaching Ionic from a Design Team and need help building components. As a developer I wanted to talk about the Web Components that are used within the Design System first. There was a decent amount of surprise, so I thought I would break down what a Design System is and why it doesn't matter which end you start with, as long as you have both your Design and Development teams working together to build your Design System.
  • Nue: A React/Vue/Vite/Astro Alternative
    13 projects | news.ycombinator.com | 14 Sep 2023
  • If Web Components are so great, why am I not using them?
    12 projects | news.ycombinator.com | 2 Aug 2023
    Examples like this bug me. The React example is using a high level abstraction, the web component is directly using the API. A more accurate example would show how those React calls eventually boil down to document.createElement()

    I don’t think the Web Components API was meant to be used directly all the time. You can use a framework like StencilJS:

    https://stenciljs.com/

  • Use Stencil / the ionic framework with emberjs [video]
    3 projects | news.ycombinator.com | 29 Jul 2023
  • World Wide Web Wars
    2 projects | dev.to | 4 Jun 2023
    You might say that this is the same vicious cycle as JavaScript frameworks. That's wrong, because Web Components are interoperable by design. Choosing Stencil or Lit or any other library is a development convenience that has little to do with the interoperability of the resulting components.
  • Is there a plugin that abstracts registering web components with React?
    3 projects | /r/reactjs | 24 Mar 2023
    I guess my problem is more specific to my overall architecture. I have components that when are placed in the DOM, have props rendered on them by their parent elements. I'm using stencil to do this.
  • The benefits of Web Component Libraries
    4 projects | dev.to | 27 Feb 2023
    Web component browser APIs aren't that many, and not that hard to grasp (if you don't know about them, have a look at Google's Learn HTML section and MDN's Web Components guide); but creating a web component actually requires taking care of many small things. This is where web component libraries come in very handy, freeing us of having to think about some of those things by taking care of them for us. Most of the things I'll mention here are handled one way of another by other libraries (GitHub's Catalyst, Haunted, Hybrids, Salesforce's LWC, Slim.JS, Ionic's Stencil) but I'll focus on Google's Lit and Microsoft's FAST here as they probably are the most used web component libraries out there (ok, I lied, Lit definitely is, FAST not that much, far behind Lit and Stencil; but Lit and FAST have many things in common, starting with the fact that they are just native web components, contrary to Stencil that compiles to a web component). Both Lit and FAST leverage TypeScript decorators to simplify the code even further so I'll use that in examples, even though they can also be used in pure JS (decorators are coming to JS soon BTW). I'll also leave the most apparent yet most complex aspect for the end.

What are some alternatives?

When comparing css-modules and stencil you can also consider the following projects:

lit - Lit is a simple library for building fast, lightweight web components.

Svelte - Cybernetically enhanced web apps

vite-ssg - Static site generation for Vue 3 on Vite

emotion - 👩‍🎤 CSS-in-JS library designed for high performance style composition

esbuild-plugin-solid

styled-components - Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅

shoelace-css - A collection of professionally designed, every day UI components built on Web standards. Works with all frameworks as well as regular HTML/CSS/JS. 🥾

catalyst - Catalyst is a set of patterns and techniques for developing components within a complex application.

postcss-nested - PostCSS plugin to unwrap nested rules like how Sass does it.

@artsy/fresnel - An SSR compatible approach to CSS media query based responsive layouts for React.

styled-jsx - Full CSS support for JSX without compromises

webcomponents - Web Components specifications