zoukankan      html  css  js  c++  java
  • win7下玩转Grunt<1>

    不小心发现草稿箱里躺着一篇文章。

    没写完,所以姑且定位为<1>……

    作为前端project师,拿到需求那一刻起,各种折腾就開始了。

    分析产品

    各种编码……

    场景一:

    改一遍结构(html,表现(css),行为(js),刷新一遍页面,循环……论ctrl+r键是怎么坏的。

    场景二:

    最终编完了……

    压缩合并网站各种文件。比方js。命令行下基于node npm安装 JSHint,压缩合并……;接着在进行CSS……

    游走在反复烦躁的工作中,宝贵的一分一秒。嗒嗒嗒……

    回到家里仅仅能用window,发誓明年一定要换成mac。

    所以、、、基于win7的Grunt教程就这么開始了

    首先下载安装node,这步非常easy,不要求最新版本号。比較新就能够

    接着安装git,在dos下也能够开发,仅仅是后面某些可选择的步骤须要用到git,因为git是Linus开发的,自然是在Linux下最无缝。在window下能够用Gygwin模拟Linux,可是有个安装包msysgit能够直接配置好git的环境,那就下载安装msysgit就好,然后在你的開始菜单里找到“Git”->“Git Bash”,就会弹出一个命令行窗体……

    键入

    npm install grunt-cli -g

    
    

    全局安装Grunt-cli

    然后再键入

    npm install grunt-init -g

    全局安装脚手架,能够帮我们完毕项目的自己主动化创建。文件夹文件,配置


    到眼下为止基本工具已经安装好了

    然后開始做点什么

    就从grunt-init,在命令行输入

    grunt-init

    C:UsersAdministrator>grunt-init
    Running "init" task
    
    A valid init template name must be specified.
    
    Available templates
    
    (No templates found)
    
    Templates that exist in the C:UsersAdministrator.grunt-init directory may be
    run with "grunt-init TEMPLATE". Templates that exist in another location may be
    run with "grunt-init /path/to/TEMPLATE". A template is a directory that must
    contain, at the very minimum, a template.js file.
    
    For more information, see http://gruntjs.com/project-scaffolding
    


    看来还须要模板。依据最后一行提示,转到http://gruntjs.com/project-scaffolding。



    网页有jQuery模板样例,可是我想要的模板的以下的,grunt-init-commonjs,点击该超链接转到github,上面有安装该模板的方法:

    找到键入

    git clone https://github.com/gruntjs/grunt-init-commonjs.git ~/.grunt-init/commonjs


    安装模板成功后

    再次在command line键入

    grunt-init common.js

    回答一些问题后就能够基于common.js构建成功grunt项目了






    http://www.w3cplus.com/tools/grunt-tutorial-configuring-tasks.html


    http://www.chawenti.com/articles/14054.html


  • 相关阅读:
    列表推导式,生成器表达式
    迭代器,生成器初始
    装饰器的进阶
    函数名用途,初始装饰器
    函数参数,和空间
    py文件的操作
    字符串相关操作
    python基础二
    Django简介
    Django初识
  • 原文地址:https://www.cnblogs.com/wgwyanfs/p/7103136.html
Copyright © 2011-2022 走看看