zoukankan      html  css  js  c++  java
  • grunt配置详情

    这个grunt配置 是我的一个程序员朋友从网上无意间看到的,然后他亲测了下,恩,是可以的。不过我到目前还未测试过是否可以。

    一、安装node, 首先确保电脑已有node的环境。
    然后 运行  npm install -g grunt-cli   
    然后运行 grunt --version 查看当前grunt是否安装;
    二、在项目根目录下面创建一个js文件,叫gruntfile.js;
        配置项如下:
        module.exports = function (grunt) {
        var config = {
            sftp: {
                'dongsheng.csgrid.cn': {  //项目名称
                    files: {
                        './': [
                            'Lib/**',
                            'css/**',
                            'js/**',
                            'img/**',
                            'Tpl/**',
                            'index.php',
                            '.htaccess'
                        ]  //本地需要上创建的文件夹,不需要可在前面加注释
                    },
                    options: {
                        // 测试环境
                        path:'/backup/apache2/vhosts/dongsheng.csgrid.cn',  //服务器端项目地址
                        host: '118.190.67.87',                                //服务器id
                        username: 'root',                                    //服务器用户名
                        password: 'chArm1nG',                                //服务器密码
                        port: 22,                                            //端口
                        showProgress: true,                                    一下默认
                        createDirectories: true,
                        srcBasePath: './'
                    }
                }
            }
        };
        grunt.initConfig(config);
        grunt.loadNpmTasks('grunt-ssh');
        grunt.registerTask('uploadtods', ['sftp:dongsheng.csgrid.cn']);//项目名称 对应上面的项目名称
    }


    三、配置好之后再当前项目下执行如下命令   
    npm install grunt --save-dev 在本地项目下面安祖行grunt,
    然后在执行   npm install grunt-ssh --save-dev  
    四、 成功之后执行  grunt uploadtods 这个命令, 他就会将你配置里需要提交的目录都提交到服务器。

  • 相关阅读:
    Azure的CentOS上安装LIS (Linux Integration Service)
    使用PowerShell在Azure China创建Data Warehouse
    通过php的MongoDB driver连接Azure的DocumentDB PaaS
    Azure RBAC管理ASM资源
    Azure基于角色的用户接入控制(RBAC)
    通过PowerShell命令给Azure VM添加CustomScriptExtension
    手把手教你创建Azure ARM Template
    MySQL数据表列转行
    MySQL
    MySQL游标使用
  • 原文地址:https://www.cnblogs.com/beyrl-blog/p/7337987.html
Copyright © 2011-2022 走看看