Skip to content

modified js.Build to create a css file from js file with import #8419

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

Closed
wants to merge 1 commit into from
Closed

modified js.Build to create a css file from js file with import #8419

wants to merge 1 commit into from

Conversation

matt9189
Copy link

I opened an issue recently due to an error when calling js.Build on a .js file with a css import (e.g. "import ./a.css"). ESBuild has this feature and it requires an outDir to work correctly. In a recent commit to support external source maps, a temporary build directory was added as an output directory, but only when the external source map option was selected.

I propose that this temporary outDir should always be created and the result.OutputFiles[] should be iterated to see if it contains a css file. The code below works correctly and creates a file called ___.js.css.

This is the first time I am attempting to commit to an open source project and I am not a professional programmer. This code is not production ready but it should serve as a good starting point. I would love some help to implement this correctly, especially as I have never written Go code before. - [email protected]

Fixes #8411

…k if any of the files are of type css to allow css imports in js files
@CLAassistant
Copy link

CLAassistant commented Apr 15, 2021

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented Jan 6, 2022

This PR has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
Please check https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md#code-contribution and verify that this code contribution fits with the description. If yes, tell is in a comment.
This PR will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@github-actions github-actions bot added the Stale label Jan 6, 2022
@github-actions github-actions bot closed this Feb 18, 2022
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESBuild supports "import *.css" in js file but needs outDir as option for js.Build
2 participants