• Grunt:GruntFile.js


    ylbtech-Grunt:GruntFile.js
    1.返回顶部
    1、
    module.exports = function (grunt) {
        grunt.initConfig({
           
            useminPrepare: {
                html: ['**/*.html', '!js/**/*.html', '!dist/**/*.html', '!node_modules/**/*.html', '!unpackage/**/*.html', '!g/tmp/**/*.html', '!s/tmp/**/*.html'],
                options: {
                    dest: 'dist'
                }
            },
            usemin: {
                html: ['dist/**/*.html'],
                options: {
                    assetsDirs: ['dist'],
                    blockReplacements: {
                        MaxPrestaJSBuild: function (block) {
                            return '<script src="/js/vendor.min.js"></script>';
                        }
                    }
                }
            },
            copy: {
                dist: {
                    files: [
                        { expand: true, cwd: 'fonts', src: '**', dest: 'dist/fonts/' },
                        { expand: true, cwd: 'bin', src: '*.dll', dest: 'dist/bin/' },
                        { expand: true, cwd: 'img', src: '**', dest: 'dist/img/' },
                        { expand: true, cwd: 'js/ueditor', src: '**', dest: 'dist/js/ueditor/' },
                        { expand: true, src: ['**/*.html', '!js/**/*.html', '!dist/**/*.html', '!node_modules/**/*.html', '!unpackage/**/*.html', '!g/tmp/**/*.html', '!s/tmp/**/*.html'], dest: 'dist/' },
                        { src: 'Global.asax', dest: 'dist/Global.asax' },
                        { src: 'NLog.config', dest: 'dist/NLog.config' },
                        { src: 'js/video/video-js.css', dest: 'dist/js/video/video-js.css' },
                        { src: 'js/video/video.6.0.js', dest: 'dist/js/video/video.6.0.js' },
                        { src: 'js/jquery.cxselect.min.js', dest: 'dist/js/jquery.cxselect.min.js' },
                        { src: 'js/cityData.min.json', dest: 'dist/js/cityData.min.json' },
                        { expand: true, cwd: 'js/my97datepicker', src: '**', dest: 'dist/g' },
                        { src:['*.aspx','*.aspx.cs','*.ashx'],dest:'dist/'}
                    ]
                },
                js: {
                    files: []
                }
            },
            htmlmin: {
                dist: {
                    options: { removeComments: true, collapseWhitespace: true },
                    files: [
                        {
                            expand: true,
                            cwd: 'dist/',
                            src: ['**/*.html', '!g/tmp/**/*.html', '!s/tmp/**/*.html'],
                            dest: 'dist/'
                        }
                    ]
                }
            },
            filerev: {
                options: {
                    encoding: 'utf8',
                    algorithm: 'md5',
                    length: 8
                },
                js: {
                    src: ['dist/js/**/m.*.min.js'],
                    dest: 'dist/js'
                },
                css: {
                    src: ['dist/css/**/m.*.min.css'],
                    dest: 'dist/css'
                }
            },
            compress: {
                main: {
                    options: {
                        archive: function () {
                            return 'dist/jfb-' + (new Date()).getTime() + '.tgz'
                        },
                        pretty: true,
                        mode: 'tgz'
                    },
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*'],
                    dest: '/'
                }
            },
            exec: {
                genGTmpl: {
                    cmd: 'tmod g/tmp --no-watch'
                },
                genSTmpl: {
                    cmd: 'tmod s/tmp --no-watch'
                }
            },
            clean: {
                dist: {
                    src: ['dist/']
                },
                tmp: {
                    src: ['.tmp/']
                },
                build: {
                    src: [
                    ]
                }
            }
        });
    
        grunt.loadNpmTasks('grunt-usemin');
        grunt.loadNpmTasks('grunt-contrib-clean');
        grunt.loadNpmTasks('grunt-contrib-copy');
        grunt.loadNpmTasks('grunt-contrib-uglify');
        grunt.loadNpmTasks('grunt-contrib-concat');
        grunt.loadNpmTasks('grunt-contrib-cssmin');
        grunt.loadNpmTasks('grunt-contrib-htmlmin');
        grunt.loadNpmTasks('grunt-contrib-compress');
        grunt.loadNpmTasks('grunt-assemble');
        grunt.loadNpmTasks('grunt-filerev');
        grunt.loadNpmTasks('grunt-exec');
    
        grunt.registerTask('build', [
            'clean:dist',
            'exec:genGTmpl',
            'exec:genSTmpl',
            'copy',
            'useminPrepare',
            'concat:generated',
            'cssmin:generated',
            'uglify:generated',
            'filerev',
            'usemin',
            'htmlmin',
            'clean:tmp',
            'copy:js',
            'clean:build',
            'compress:main'
        ]);
    };
    2、
    2.返回顶部
     
    3.返回顶部
     
    4.返回顶部
     
    5.返回顶部
     
     
    6.返回顶部
     
    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    js 生成32位UUID方法
    win10把控制声音改成和win7一样
    jQuery.inArray()方法
    在eclipse中安装activiti插件
    关于NOIP运输计划一题几种思路和若干种做法的研究
    该博客停止更新
    [CTSC2010]产品销售
    roi 学习轨迹
    「PA 2019」Szprotki i szczupaki
    LOJ576签到游戏
  • 原文地址:https://www.cnblogs.com/storebook/p/9223172.html
Copyright © 2020-2023  润新知