1

This is the code:

// Only gzip javascript files:
gzip.staticGzip(__dirname + '/public', { matchType: /javascript/ })

This is the node.js module: https://github.com/nateps/connect-gzip

It signifies compression only for javascript files. How can I specify compression for files either javascript or css? since I want to enable compression for both.

3 Answers 3

3

You should be able to use the | (or) operator in the provided regular expression to match on either:

gzip.staticGzip(__dirname + '/public', { matchType: /javascript|css/ })
Sign up to request clarification or add additional context in comments.

Comments

1

replace:

gzip.staticGzip(__dirname + '/public', { matchType: /javascript/ })

on:

gzip.staticGzip(__dirname + '/public', { matchType: /javascript|css/ })

Comments

0

Something like this?

gzip.staticGzip(__dirname + '/public', { matchType: /javascript|CSS|HTML|WHATEVER/ })

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.