Replies: 2 comments 1 reply
This comment was marked as spam.
This comment was marked as spam.
-
Hey! Right now we consider imports with remote URLs as something we don't bundle and keep in the CSS. While we could indeed download the imported file and embed it, there are some caveats to keep in mind:
If we would download the CSS then we loose these features. To prevent confusion, especially around changing contents of a remote URL after you deployed, we decided to not do anything special here and rely on the browser to download the necessary resources. To solve your use case, since a build is required, what you could do is download the remote file to a local file and import the generated file. If you do this as part of a build step, then you still have the benefit of sharing the contents between projects. |
Beta Was this translation helpful? Give feedback.
-
What version of Tailwind CSS are you using?
v4.0.0-beta.3
What build tool (or framework if it abstracts the build tool) are you using?
Standalone CLI (from https://github.com/tailwindlabs/tailwindcss/releases)
What version of Node.js are you using?
N/A (using standalone CLI)
What browser are you using?
Firefox
What operating system are you using?
Linux
Reproduction URL
Use
@import
on a remote source, like@import "https://pastebin.com/raw/ctzSxFsQ";
Here is a link to a Tailwind playground with what I expect to work:
https://play.tailwindcss.com/n1z6Daungc?file=css
I expect it to remotely import a pastebin I created, which contains the following:
Describe your issue
In Tailwind v4, the docs suggest that the built in
@import
resolution works with@theme
and other tailwind specific directives. And it does, with local file imports. However, it is missing support for remote url imports. Currently, nothing happens when you import from an http url. The compiled output just leaves the import in (like the line@import "https://example.com/styles.css";
is in the compiled output directly, and is not fetched and inlined in). Now that the configuration file is "just" a css file, it feels like this should be possible.I'm not sure what the desired behavior would be here. If it is intended that remote imports do not work, I think it should be documented.
I do have a use case for this, where I want a "base" theme configuration which my custom plugins to "inherit" from. It would be great to have the build and intellisense work with my base theme, without copy/pasting in the "base" into every plugin. (note that by plugin, I do not mean a tailwind plugin, but rather a plugin for my own app which can add its own markup that may include tailwind styles which need to be compiled).
Beta Was this translation helpful? Give feedback.
All reactions