grunt-useminでファイルの重複処理が気になる年頃

 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
31
32
33
34
35
36
37
38
39
useminPrepare: {
    options: {
        dest: '<%= config.dist %>',
        flow: {
            steps: {
                js: ['concat', 'uglifyjs'],
                css: ['concat', 'cssmin']
            },
            post: {
                css: [{
                    name: 'concat',
                    createConfig: function(context, block){
                        var generated = context.options.generated;
                        var obj = {};
                        var uniq = generated.files.filter(function(x){
                            var flag = obj[x.dest];
                            obj[x.dest] = true;
                            return !flag;
                        });
                        generated.files = uniq;
                    }
                },{
                    name: 'cssmin',
                    createConfig: function(context, block){
                        var generated = context.options.generated;
                        var obj = {};
                        var uniq = generated.files.filter(function(x){
                            var flag = obj[x.dest];
                            obj[x.dest] = true;
                            return !flag;
                        });
                        generated.files = uniq;
                    }
                }]
            }
        }
    },
    html: '<%= config.app %>/*.html'
},
1
html: '<%= config.app %>/usemin.html'

Comments

comments powered by Disqus