Simplify API #2
Closed
BryceRussell
started this conversation in
Ideas
Replies: 1 comment
-
6 months later...Shorten module namesModule are now created dynamically and use the name of the package and module to create an import name, for example: import "my-theme/css";
import { ... } from "my-theme/assets";
import { ... } from "my-theme/layouts";
import { ... } from "my-theme/components"; Flatten exports
I chose to not flatten this option and to instead allow theme imports to be created dynamically using a glob, an array of imports, or an object of exports. Simplified example of default imports for themes: imports: {
css: "**.css",
assets: "**.{png,jpg}",
layouts: "**.astro",
components: "**.astro"
} Creates: import "my-theme/css";
import { ... } from "my-theme/assets";
import { ... } from "my-theme/layouts";
import { ... } from "my-theme/components"; Multiple IntegrationsThis has not been addressed yet, but there is an issue open for it, hopefully soon! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Simplify API
Shorten module names
Currently modules names are prefixed with
virtual:
But, this could be simplified to:
Flatten exports
Currently there is an
exports
option for configuring virtual modulesBut, this could be simplified to:
Cons
One benefit of keeping the
exports
object is that modules could be created dynamically by the author instead of being hardcodedMultiple Integrations
Currently, when creating a theme that includes other integrations it can be confusing:
But this could be simplified to:
Beta Was this translation helpful? Give feedback.
All reactions