Comments (4)
You should make sure that the CSS file is large enough for it to be compressed significantly enough for the compression to make sense (otherwise the browser will spend more time unzipping the file than in just receiving it uncompressed).
This is expressed using the ratio
option, it defaults to .8
from what I can see. This means that the compressed file should have at most 0.8 times the size of the original file.
Because for really small files, the gzipped one can even be (much) larger than the original, setting the ratio
to 1 is not enough. I set it to 4, but to make sure it really always works, you could set it to Infinity
.
Hope this helps!
Typed on my smartphone, so will contain errors.
On 15 Mar 2016, at 20:40, CJ Lazell [email protected] wrote:
@romeovs what settings did you use to get it to work and gzip the css?
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
from compression-webpack-plugin.
OK. Let's just say I was tired yesterday. It turns out the css file wasn't gzipped because the ratio wasn't good enough.
from compression-webpack-plugin.
This is my config:
var Compression = require('compression-webpack-plugin')
var Extract = require('extract-text-webpack-plugin')
var path = require('path')
module.exports = {
context: path.resolve(__dirname)
, entry: {
main: [
'./src/index.js'
, './src/style.css'
]
}
, output: {
path: path.resolve(__dirname, 'assets')
, filename: '[name].[hash].js'
}
, module: {
loaders: [
{
test: /\.css$/
, loader: 'extract-text-webpack-plugin/loader?extract&remove!css'
}
]
}
, plugins: [
new Extract('[name].[hash].css', {
allChunks: true
})
, new Compression({
asset: '{file}.gz'
, algorithm: 'gzip'
})
]
}
from compression-webpack-plugin.
@romeovs what settings did you use to get it to work and gzip the css?
from compression-webpack-plugin.
Related Issues (20)
- [types] Failed to import new types HOT 3
- [types] `@gfx/zopfli` can't be used with new types HOT 3
- Getting error TS1005: '?' expected HOT 2
- Always 404, I don't know why, HOT 2
- gzipped css not updated in html file HOT 19
- compress images not work HOT 2
- TypeError: Cannot read properties of undefined (reading 'tapPromise') HOT 1
- Allow usage of 6.x version without md4 HOT 4
- ERROR in Conflict: Multiple assets emit different content to the same filename css/.gz HOT 1
- Restoring failed for CompressionWebpackPlugin; HookWebpackError: this._obj.updateHash is not a function HOT 5
- Some of the files ignored during build compression HOT 10
- How to do this compression from express? HOT 1
- How to use deleteOriginalAssets is true ? HOT 2
- Compressed build now working on browser HOT 6
- Version 6 (for Webpack 4) does not work on Node 18+ HOT 10
- Let users exclude files or folder from deleting original assets. HOT 1
- Compression-webpack-plugin running before HtmlCriticalWebpackPlugin completes. HOT 2
- Ability to exclude files from deletion after zipping. HOT 1
- Type definition `BasePluginOptions` property `test` should use `Rules`, not `Rule`
- compression-webpack-plugin .woff compression is not supported HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compression-webpack-plugin.