zoukankan      html  css  js  c++  java
  • 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/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    We7网站群系统中标胜利油田项目 开源CMS
    We7荣获“政府网站群建设最佳产品奖” 开源CMS
    JAVA中 成员变量和和实例变量区别 前行
    HTTPS 加密原理探究 前行
    zip mysql安装启动方式 前行
    如何获取监听iframe src属性的变化进行后续操作 前行
    js分割url提取参数 前行
    web跨域问题解决方案 前行
    作业3.18
    3.26作业
  • 原文地址:https://www.cnblogs.com/storebook/p/9223172.html
Copyright © 2011-2022 走看看