【问题标题】:Grunt Task in Release Manager: Default not foundRelease Manager 中的 Grunt 任务:未找到默认值
【发布时间】:2017-12-08 00:07:01
【问题描述】:

我无法让简单的 Grunt 任务在发布管理器中工作。我不断收到警告:找不到任务“默认”。使用--force,继续。我添加了 --force 以防止构建失败,但未处理 grunt 任务。我已经登录到构建代理并手动运行 grunt 没有任何问题。

任何帮助或想法将不胜感激。

谢谢,

module.exports = 功能(咕噜声){ '使用严格';

grunt.initConfig({

    //Read the package.json (optional)
    pkg: grunt.file.readJSON('package.json'),

    // Cache bust css, update AppInsights key, remove all custom js imports from index.html, https url rewrites
    processhtml: {
        dev: {
            options: {
                data: {
                    appInsightsKey: 'f8d00249-dd60-44be-9145-dcb303e5fd19',
                    timestamp: Date.now()
                }
            },
            files:
            {
                'wwwroot/index2.html': ['wwwroot/index.html']
            }
        },
    },
    // Combine and minify all js in /app folder and subfolders into app.min.js
    uglify: {
        dev: {
            src: ['wwwroot/app/app.module.js', 'wwwroot/app/**/*.module.js', 'wwwroot/app/core/*.js', 'wwwroot/app/services/*.js', 'wwwroot/app/layout/*.js', 'wwwroot/app/**/*.js'],
            dest: 'wwwroot/app/app1.min.js'
        }
    },
    // Delete all js except for app.min.js in /app folder and subfolders
    clean: {
        dev: {
            options: {
                force: true
            },
            expand: true,
            src: ['app/**/*.js', '!app/app.min.js']
        }
    }
});

grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask("default", "watch");

// If no target provided, default to dev
var target = grunt.option('target') || 'dev';
//grunt.registerTask('default', ['processhtml:' + target, 'uglify:' + target, 'clean:' + target]);
grunt.registerTask('default', ['processhtml:' + target, 'uglify:' + target]);

};

Grunt Task

【问题讨论】:

  • 可以添加代理的日志吗?这可能会有所帮助

标签: gruntjs azure-pipelines-release-pipeline


【解决方案1】:

根据截图,您将package.json指定为grunt文件,默认情况下,该文件是js文件(例如Gruntfile.js),因此请检查您是否指定了正确的文件。

【讨论】:

    猜你喜欢
    • 2018-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-21
    • 1970-01-01
    • 1970-01-01
    • 2014-08-27
    相关资源
    最近更新 更多