Skip to content
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

Add map option to PostCSS options. #4980

Open
tech4him1 opened this issue Jul 20, 2018 · 9 comments
Open

Add map option to PostCSS options. #4980

tech4him1 opened this issue Jul 20, 2018 · 9 comments

Comments

@tech4him1
Copy link

There is currently a no-map setting allowed for PostCSS, which disables the inline sourcemaps. However there is no options for having external sourcemaps generated. Looking into the PostCSS docs and the postcss-cli code, it looks like a --map option can be passed to the CLI to enable "separate-file" sourcemaps.CLI code docs

I request that a "map" option is added along-side the "noMap" option that can already be passed into the PostCSS resource function.

@bep bep added the Wish label Jul 20, 2018
@stale
Copy link

stale bot commented Nov 17, 2018

This issue 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.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Nov 17, 2018
@tech4him1
Copy link
Author

I feel this is still an important feature request, as right now SASS and PostCSS sourcemaps cannot be used together through Hugo. The underlying PostCSS engine is already designed to support this usecase, so Hugo should only have to create a hook to allow it, as described in the OP.

@stale stale bot removed the Stale label Nov 23, 2018
@bep
Copy link
Member

bep commented Nov 23, 2018

The underlying PostCSS engine is already designed to support this usecase, so Hugo should only have to create a hook to allow it, as described in the OP.

I think you are over-simplifying this. If this was simple, I would have already done it when I added this feature.

@tech4him1
Copy link
Author

@bep Do you have any specific information on what you would need? I'm not comfortable with submitting a patch in Golang, but I could try to work on some code that you could use as a starting point if you'd like.

@DennisJohnsen
Copy link

+1 for this feature.

We at our web development department in LEGO A/S are currently rolling out a new framework for building websites, that uses HUGO to generate the pages. I'm trying to set up the best possible development environment for other frontend developers in our department. Therefore a better way than using inline source mapping would be awesome for debugging the SCSS structure directly from the browser.

@bep
Copy link
Member

bep commented Feb 25, 2019

So,

The current implementation reads from PostCSS's output stream - which, I assume, is only "one thing". So to implement the map option, you would have to write to files. Which would be slower, but that should be negligible and could be wrapped in an if map construct.

That said,

For that to be of any value, PostCSS would need to construct a source map of the entire chain of source maps (SCSS ... PostCSS). If you cannot navigate from "right click element" in Chrome to the style implementation in the SCSS, I'm not sure what value it gets you.

So, the current way to do this is to be a little bit pragmatic during development:

{{ if eq hugo.Environment "production" }}
{{ $css = ... | toCSS | postCSS }}
{{ else }} 
{{ $css = ... | toCSS $optionsWithSourceMap }}
{{ end }}

So, before we start to spend time supporting a map option, someone would have to look at how it would work once implemented.

/cc @regisphilibert

@regisphilibert
Copy link
Member

PostCSS + Pipes expert around here is @budparr

@DennisJohnsen
Copy link

Hmm, i guess that could be a solution as well, to use an environment variable. Since we don't really need to have source maps available on the live environment.

I can hand this solution over to the team tomorrow, as i think it might be good enough for a proper development environment. Thanks for the quick reply btw 😃

On another note; I can also say we're looking forward for HUGO being able to support JSON directly instead of Markdown. It will make a lambda obsolete and make our whole pipeline much cleaner 👍

@stale
Copy link

stale bot commented Jun 25, 2019

This issue 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.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Jun 25, 2019
@stale stale bot closed this as completed Jul 25, 2019
@bep bep reopened this Feb 25, 2020
@stale stale bot removed the Stale label Feb 25, 2020
@bep bep modified the milestones: v0.66, v0.67 Feb 25, 2020
@bep bep modified the milestones: v0.67, v0.68 Mar 9, 2020
@bep bep modified the milestones: v0.68, v0.69 Mar 20, 2020
@bep bep modified the milestones: v0.69, v0.70 Apr 8, 2020
@bep bep removed this from the v0.70 milestone Apr 28, 2020
@bep bep modified the milestones: v0.114.0, v0.115.0 Jun 13, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 4, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
@bep bep modified the milestones: v0.124.0, v0.125.0 Mar 4, 2024
@bep bep modified the milestones: v0.125.0, v0.126.0 Apr 23, 2024
@bep bep modified the milestones: v0.126.0, v0.127.0 May 15, 2024
@bep bep modified the milestones: v0.127.0, v0.128.0 Jun 8, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants