jsr icon indicating copy to clipboard operation
jsr copied to clipboard

Can I publish CSS on JSR?

Open o-t-w opened this issue 1 year ago • 5 comments

If I wanted to install CSS from JSR using CSS module scripts & import attributes, would that be possible?

o-t-w avatar Mar 16 '24 20:03 o-t-w

I just tried this today and am hitting error: The import attribute type of "css" is unsupported. “Import Attributes” is a Finished Proposal according to the TC39 process. Any tickets which could be followed here?

theengineear avatar Nov 06 '24 15:11 theengineear

@theengineear Import attributes are finished but CSS imports are not.

phaux avatar Nov 06 '24 17:11 phaux

Got it — are JSON Modules good to go then at this point then? Is this the right ticket to follow for updates (given that Import Attributes are done, I get the sense that CSS imports will not be far off — they’re already supported in some browsers).

(thanks for the quick response, btw)

theengineear avatar Nov 06 '24 18:11 theengineear

@theengineear i'm currently able to successfully publish on JSR with this in my module: 😉

import jsrJSON from './jsr.json' with {type: 'json'};
/** The version of this module. */
export const version: string = jsrJSON.version;
/** The package name/ID of this module on JSR */
export const id: string = jsrJSON.name;

TriMoon avatar Feb 28 '25 10:02 TriMoon

I tried:

import '../style.css' with { type: 'css' }

Does not seem to work at the moment. Would be cool to be able to use.

Is there another way to publish css along with a JSR module?

danielbeeke avatar May 06 '25 21:05 danielbeeke