Replies: 4 comments 7 replies
-
it looks like the css files prefixed with /node_modules/ are also not getting bundled by the build command? |
Beta Was this translation helpful? Give feedback.
-
Hey @lschierer I'm not super familiar with Spectrum or have tried dynamically importing CSS Module Scripts with Greenwood, so can't say for certain without getting more hands on and / or seeing more of the code I think. Do you have a reproduction repo you can share? As far as being able to just use a bare specifier, I think that would only work if the package exposes an export / entry point for it which it seems like these packages do, for example: So dynamic import aside for now, I would generally expect something like this to work, but honestly can't say I've tested bare specifiers in the context of CSS Modules Scripts like before 🙈 import sheet from "@spectrum-css/tokens" with: { type: "css" }; I would be curious if this works though, using a relative file path import sheet from "../path/to/node_modules/@spectrum-css/tokens/dist/index.css" with: { type: "css" };
# or even this maybe?
import sheet from "@spectrum-css/tokens/dist/index.css" with: { type: "css" }; But yeah, if you have a little reproduction repo to share that would be great for helping me to dive in see what's going on. Either way what you're doing seems like it should be supported by Greenwood in some capacity and we would love to make sure something like Spectrum is supported, and so will definitely keep this in mind as we start our ecosystem compat phase next. |
Beta Was this translation helpful? Give feedback.
-
so with the change you proposed, I can consistently style, but only so long as I import with full paths from the project root, /node_modules/@spectrum-css/.... which flies in the face of the "rule of thumb" in https://greenwoodjs.dev/docs/resources/scripts/#node-modules. it appears that not just the html script tag, but the script sources need to use full paths? I mean, I'm happy that I can style fairly consistently now, but as you can probably tell from the flurry of bug reports I've submitted, I tend to look for consistent documentation as well ;-) |
Beta Was this translation helpful? Give feedback.
-
I'm actually still finding it extremely fragile and working on and off in ways I don't fully understand. This is (as the repository name suggests) my 4th attempt at a new generation of my site, mostly because I'm trying to do some things that are just beyond my capabilities really, and I keep trying different tools and approaches to see if one of them proves to be easier for me to grasp. Some of this was also caused because Astro announced the deprecation of their support for Lit, and I really don't want to try to learn a new javascript framework. You are certainly free to look it over, but I'm saying this much because I'm honestly not sure it'll be of much use because I am not very far along. |
Beta Was this translation helpful? Give feedback.
-
I am using CSS from the Adobe Spectrum CSS project and it uses exports similar to
@spectrum-css/tokens/dist/index.css
where@spectrum-css/tokens
is the name of the particular package (that one is the base package that has all the design tokens the rest of their packages depend on).I'm currently importing these with
but from what I read, because they are in node_modules, I ought to be able to use bareword imports without the /node_modules/ part. When I try however, it doesn't find the modules. I believe this is because they end in .css and not in .js, .ts, .mjs, or .mts? Is there a configuration option I've missed?
Beta Was this translation helpful? Give feedback.
All reactions