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

Enable passing terser options with rails directly to Terser::Compressor #46

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

javier-menendez
Copy link
Contributor

Purpose

Add a way to pass options to the terser compressor when using rails.

Existing way:

config.assets.js_compressor = Terser.new(compress: { drop_console: true })

The problem with this way of passing options is that bypasses the Terser::Compressor class and uses directly Terser#compile since there is an alias for compress

Proposed new way:

config.assets.js_compressor = :terser
config.assets.terser = { compress: { drop_console: true } }

This way the Terser::Compressor is going to be used with their call methods according to the Sprockets version

@ahorek ahorek merged commit 5f1d29a into ahorek:master Oct 19, 2023
10 checks passed
@ahorek
Copy link
Owner

ahorek commented Oct 19, 2023

thanks!

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 this pull request may close these issues.

2 participants