grunt-contrib-compress(とnginx)でトラフィックを軽くしよう

1
gzip_static on;
1
npm install -g grunt-contrib-compress
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
compress: {
    all: {
        options: {
            mode: 'gzip',
            level: 9
        },
        files: [{
            expand: true,
            cwd: '<%= config.dist %>',
            dest: '<%= config.dist %>',
            src: ['**/*.js'],
            ext: '.js.gz',
            extDot: 'last'
        },{
            expand: true,
            cwd: '<%= config.dist %>',
            dest: '<%= config.dist %>',
            src: ['**/*.css'],
            ext: '.css.gz',
            extDot: 'last'
        },{
            expand: true,
            cwd: '<%= config.dist %>',
            dest: '<%= config.dist %>',
            src: ['**/*.html'],
            ext: '.html.gz',
            extDot: 'last'
        }]
    }
},
1
2
3
4
5
grunt.registerTask('deploy', [
    'build',
    'compress:all',
    'rsync:prod'
]);
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy