Grunt构建在文本编辑器中打开grunt.js

时间:2015-11-07 11:22:18

标签: node.js gruntjs

每当我运行<?php require_once('/include/global.php'); /*if(isset($_POST['login'])){ if($_POST['username'] != '' && $_POST['password']!=''){ if(!isset($_SESSION)) { session_start(); session_register('username'); } $result = mysql_query("SELECT * FROM login WHERE username='" . $_POST["username"] . "' and password = '". $_POST["password"]."'"); $row = mysql_fetch_array($result); if(is_array($row)) { $_SESSION["username"] = $row[$_POST["username"]]; $_SESSION['username'] = $_POST["username"]; header("Location:homepage.php"); } else { $message = "Invalid Username or Password!"; } }else{ $error_msg="Please fill all the fields"; } }*/ if(isset($_POST['login'])){ $username = $_POST['username']; $password = $_POST['password']; if($username != '' && $password!=''){ session_start(); $sql = "SELECT * FROM login WHERE username=? and password =?"; $stmt = $con->prepare($sql); $stmt=bind_param("ss", $username, $password); $stmt->execute(); $stmt->store_result(); $num->$stmt->num_rows; $stmt->close(); if($num>0){ $_SESSION['username'] = $username; header("Location: homepage.php") ; die(); } else { $message = "Invalid Username or Password!"; } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Clinic Form</title> <link href="css/1140.css" rel="stylesheet" type="text/css" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300" rel="stylesheet" type="text/css" /> </head> <body> <div class="container12"> <header> <div class="row" align="center"> <div class="column12"> <a href="index.php"><img src="images/logo.png"/></a> </div> </div> </header> <h1 id="home" align="center">Login</h1> <form action="" method="POST"> <?php if(isset($message)) echo "<script type='text/javascript'>alert('$message');</script>" ?> <div class="alert"> <?php if(isset($error_msg)) echo "<script type='text/javascript'>alert('$error_msg');</script>" ?> </div> <div class="column12" align="center"> <div class="row"> <input type="text" class="large-fld" name="username" value="" placeholder="Username" /> </div> <div class="row"> <input type="password" class="large-fld" name="password" value="" placeholder="*****" /> </div> <div class="row"> <input type="image" name="login" value="Login" src="images/btn.png" width="widthInPixels" height="heightInPixels" onMouseOver="this.src='images/rollOverBtn.png';" onMouseOut="this.src='images/btn.png';"> </div> </div> </form> </div> </body> </html> 时,会出现一个对话框,询问我是否要运行此文件。当我点击grunt build --platforms=win时,所有发生的事情都是Notepad ++打开Yes

我有什么问题吗?

2 个答案:

答案 0 :(得分:0)

来自Grunt Docs

如果您与Gruntfile位于同一目录中,则Windows会在您键入grunt时尝试执行该文件。因此,您需要输入DOSKEY

另一种方法是使用grunt.cmd命令创建Grunt宏,遵循这些指示。这将允许您使用grunt而不是DOSKEY grunt=grunt.cmd $*

这是您使用的DOSKEY命令:

@WebServlet("/HttpServlet")
public class SimpleHttpServlet extends HttpServlet {

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { 
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<body>");
        out.println("<h1>Hello Servlet Get</h1>");
        out.println("</body>");
        out.println("</html>");
    }
}

答案 1 :(得分:0)

Grunt在当前目录中查找名为grunt.js的文件。您已将文件命名为npm install -g grunt grunt-cli,而Windows正在尝试执行该文件。

您应该使用C:>grunt

将grunt安装为全局资源

我遇到过nodejs没有将npm全局文件夹添加到系统路径的问题。如果您已在全球范围内安装了grunt,并且正在运行C:\Users\<username>\AppData\Roaming\npm; 并不起作用。您需要添加以下路径:

    <body>        

        <form id="form" action="/acctCreated" method="POST">
        <label>Card #: <input type="text" size="16" data-stripe="number" placeholder="Card number" /></label>
        <label>Expiry month: <input type="text" size="2" data-stripe="exp-month" placeholder="MM" /></label>
        <label>year: <input type="text" size="2" data-stripe="exp-year" placeholder="YY" /></label>
        <label>CVC: <input type="text" size="4" data-stripe="cvc" placeholder="CVC" /></label>

        <button type="submit">Pay</button>
    </form>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="https://js.stripe.com/v2/"></script>

    <script type="text/javascript">
        Stripe.setPublishableKey('pk_test_mHCVXXlu5il6pgbQCQzmKY2S');

        var $form = $('#form');
        $form.on('submit', function() {
            // First submit the card information to Stripe to get back a token
            Stripe.card.createToken($form, function(status, response) {
                var token = response.id;

                // Save the token into a hidden input field
                $form.append($('<input type="hidden" name="stripeToken" />').val(token));

                // Now submit the form to our server so it can make the charge against the token
                $form.get(0).submit();
            });
            return false;
        });
    </script>
    </body>

右键单击&#34;我的电脑&#34;并选择&#34;高级系统设置&#34;。单击&#34;环境变量&#34;按钮和上面的&#34; PATH&#34;变量

您需要重启和DOS shell才能看到更改工作。

相关问题