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

Unable to disable source maps #58

Closed
alexanderjakob opened this issue Jan 11, 2024 · 8 comments · Fixed by #59
Closed

Unable to disable source maps #58

alexanderjakob opened this issue Jan 11, 2024 · 8 comments · Fixed by #59

Comments

@alexanderjakob
Copy link

Hey everybody,

I'm trying to disable the output of the link to a source map URL - I don't want to have a source map comment in my generated CSS file. My first thought was: this is easy, just set inside sass_options node source_map: false - didn't work. Ok, just set embed_source_map: false - didn't work.

Command: '/var/www/html/var/dart-sass/sass' '/var/www/html/assets/website/styles/main.scss:/var/www/html/var/sass/main.output.css' '--style=expanded' '--no-source-map' '--no-embed-source-map'

--embed-source-map isn't allowed with --no-source-map.

So, it seems that the combination of these options is not allowed - can you guys help me out and tell me how to disable it.

Thank you in advance!

@bocharsky-bw
Copy link
Member

As I understand Sass complains about this? If so, then the question is probably to Sass not to this bundle.

About this:

source_map: false - didn't work

IIRC that's exactly what add that --no-source-map option in your command dump. Also you say "--embed-source-map isn't allowed with --no-source-map" but in your command I see you don't have that --embed-source-map but have --no-embed-source-map instead?

Could you just try to pick up the options that fit your needs by executing that internal/var/www/html/var/dart-sass/sass' '/var/www/html/assets/website/styles/main.scss:/var/www/html/var/sass/main.output.css' '--style=expanded' command manually? As soon as you have correct options - you just need to set them in the Sass bundle config and it should work I think, because the bundle just converts that config into those options like --source-map/--no-source-map, nothing special

@alexanderjakob
Copy link
Author

alexanderjakob commented Jan 13, 2024

Thank you, @bocharsky-bw

I tried following code
/var/www/html/var/dart-sass/sass '/var/www/html/assets/website/styles/main.scss:/var/www/html/var/sass/main.output.css' '--style=expanded'

My css file has a sourcemap link in it - I don't want that. 👎

I tried the following code
/var/www/html$ /var/www/html/var/dart-sass/sass '/var/www/html/assets/website/styles/main.scss:/var/www/html/var/sass/main.output.css' '--style=expanded' '--no-source-map'

My css file has no sourcemap link in it - I really want that 👍

--

My point is that it seems, that these options --[no-]source-map and --[no-]embed-source-map are always added because of missing possibility to really disable the option via symfonycasts_sass.yaml file. If I set it to false like so:

symfonycasts_sass:
    sass_options:
        source_map: false
        style: expanded

it is added as '/var/www/html/var/dart-sass/sass' '/var/www/html/assets/website/styles/main.scss:/var/www/html/var/sass/main.output.css' '--style=expanded' '--no-source-map' '--embed-source-map' with an embed-source-map option (due to default value behavior I think, see here).

Because these options always have to be a boolean value it is currently not possible to disable it at all (e.g. source_map: null) and there were always options set. I must definitely relate to this bundle - not to Sass.

@smnandre
Copy link
Contributor

I'm sorry i believed i sorted this .... but it reality i did not.

2 things:

i do believe this option (embed source maps) should be without default (especially because with AssetMapper the source maps do not work so..)

To fix things, i can hard-code a test to remove the 2 source maps options if sourcemap is false ?

wdyt @bocharsky-bw ?

@bocharsky-bw
Copy link
Member

Hm, I'm not sure I got it... OK, embed_source_map has a default value, but you can override it with a custom value, no? Or setting embed_source_map to false does not work somehow? We ignore the value from the config?

@alexanderjakob
Copy link
Author

Hm, I'm not sure I got it... OK, embed_source_map has a default value, but you can override it with a custom value, no? Or setting embed_source_map to false does not work somehow? We ignore the value from the config?

That's the point: if we set it to false, it is always outputted - and combining is forbidden.

A solution could be to remove all embed_source_map (true AND false) options when setting source_map: false as @bocharsky-bw said.

@smnandre
Copy link
Contributor

I'll do that

@bocharsky-bw
Copy link
Member

Hey @alexanderjakob

Could you give #59 a try, please? Does it solve your problem?

@alexanderjakob
Copy link
Author

alexanderjakob commented Jan 17, 2024

@bocharsky-bw
@smnandre
Works perfectly, great job, thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants