-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep "import css" line to the output file? #204
Comments
This comment has been minimized.
This comment has been minimized.
same issue for me! Is there any solution to realize that? |
Same issue for me too |
I'm working on this. Related code: rollup-plugin-postcss/src/postcss-loader.js Lines 179 to 186 in 34811b7
|
I have done this except for the last step. But I wonder that |
anyone can tell me the really production use? I have no idea now |
The production use is this @himself65 At the moment most library authors bundle an entire styles.css file which is all the styles needed for all their components; This is not ideal as it imports styles for components the consumer isn't using into their project. If the requires(".css") statements are left in the output library consumers will automatically import only the critical css that they need as they import the components they want. To get around this i issue iv'e created a hack work around which works for me in the meantime. |
@ShanonJackson would you care to share your hack workaround? We have a similar issue with this too. We have many small packages and having to manually import the css files at app level will be a real headache. I'd rather leave the import in the rolled-up package and then the app can just handle css imports. |
We leave the actual
|
Any new? |
we choose add 'import css' line to the dist file after build finish with fs.writefile |
It's not only about keeping the import statement, but also keeping the As I mentioned here, I've drafted a plugin for this. Here is the original comment, I appreciate any idea to improve this. I'm in the same situation. I have source files in this structure
I expected the dist files structure
And in
And the name should be rather than I drafted a plugin to explain my idea, here is the codesandbox. The file name is The content is plain CSS rather than JS. Here is the main code
I'm not familiar with Rollup's mechanism, but I believe there must be a better way to achieve this. Anyone who has an idea, please let me know. |
hey, was looking into the same thing when the size of our css bundle started exceeding the size of the html. is there any chance for this to make work or are there any known alternatives? |
Rollup Config
src/index.js
Expected bundle
The text was updated successfully, but these errors were encountered: