Giter Site home page Giter Site logo

grunt-learn's Introduction

// module.exports = function(grunt) {//wrapper函数
//     //注册任务
//     /*
//     * grunt.registerTask(taskName, [description, ] taskList/callback)
//     * taskName:任务名称
//     * description:任务描述,可选
//     * taskList:任务数组,在执行当前任务前需要执行的任务列表,顺序执行
//     */
//
//     // Project configuration.
//     grunt.initConfig({ //各个任务的配置都在initConfig里
//         // 任意数据。
//         pkg: grunt.file.readJSON('package.json'),//--------导入外部数据
//         my_property: 'whatever',
//
//         uglify: {//grunt concat  遍历包含的所有目标并依次处理
//             options: {
//                 // 这里是任务级的Options,覆盖默认值
//                 banner: '/*! <%= pkg.name %> */\n'//--------使用外部数据
//             },
//
//             // 这里是concat任务的配置信息。
//            inner:{
//                //grunt concat:inner 执行特定目标
//
//                //格式一
//                src: ['src/bb.js', 'src/bbb.js'],//源文件
//                dest: 'dest/b.js',//目标文件
//                //格式二
//                files: {
//                    'dest/b.js': ['src/bb.js', 'src/bbb.js'],
//                    'dest/b1.js': ['src/bb1.js', 'src/bbb1.js'],
//                },
//                //格式三:
//                //files: [
//                //    {src: ['src/aa.js', 'src/aaa.js'], dest: 'dest/a.js'},
//                //    {src: ['src/aa1.js', 'src/aaa1.js'], dest: 'dest/a1.js'},
//                //],
//
//                options: {
//                    // 单个目标的options,不需要可忽略
//                },
//            }
//         },
//         //...
//     });
//
// };

module.exports = function(grunt){
    grunt.registerTask('test1',function(){
        //var done = this.async();//处理异步
        console.log(1);
        setTimeout(function(){
            console.log("end");
            //done();//完成
        },6000);
    });
    grunt.registerTask('test2',function(){
        console.log(2);
    })
    grunt.registerTask('test3',function(){
        console.log(3);
    });
    grunt.registerTask('test4',function(){
        console.log(4);
    })
    grunt.registerTask('test','aa',['test1','test2','test3','test4'])

    grunt.registerTask('n1','bb',function(){
        grunt.task.run(['test1','test2','test3','test4']);
    })
}

grunt-learn's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.