tomhodgins / css-package-manager

A Package Manager for CSS Extensions
26 stars 1 forks source link

Brainstorm! #1

Open gmemstr opened 4 years ago

gmemstr commented 4 years ago

Let's brainstorm how we could make this work!

Taken from Discord:

image

gmemstr commented 4 years ago

I personally quite like the idea of embedding the packages directly into the stylesheet, although I wonder how easy the second, "alternative" approach would be. Maybe we take a hybrid approach? e.g

@--package-bootstrap {}
body {
    display: bootstrap-display;
}

Feel free to correct my CSS formatting but that's sort of what I have in my head. @--package- would help us parse out the packages that need to be brought in, maybe with the ability to define explicit URLs/versions/hashes with

@--package-bootstrap {
    url: url("https://example.com/bootstrap/v1.css");
}

(again, CSS syntax isn't perfect)

Dan503 commented 4 years ago

index.css

@require("package-one")
@require("package-two")

main {
  /* normal styles */
}

You could then maybe use PostCSS to take note of all the require statements before stripping them out.