Skip to content

Why is CSS extended in JavaScript files instead of in CSS files? #86

@chriseppstein

Description

@chriseppstein

I just don't understand why CSS files would be extended from JS files instead of by the CSS files themselves. If the behaviors are defined in CSS files, then there is a natural scope for which the custom behaviors would be defined, puts the behavior closer to where it is used, and makes delivering the stylesheets with their dependencies much easier (via css @import or inline).

Furthermore, when we put code that is essential to the CSS developer's experience in a file of a completely different type, we create a boundary that can feel scary for them to cross. If we put the logic for custom behaviors in CSS we are telling those developers "This is for you. you can do this." which is very empowering.

Lastly, I think it would be great if the scripting ability that is used for extending css was not JavaScript, but actually a scripting language that is designed and allowed to be used throughout the CSS file, but also within the extensible constructs provided by houdini. I'm sure this is a non-starter, but we've seen this approach be very successful in Sass, and the scripting syntax we've developed there would make a good starting point for a CSS-specific script.

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