zoukankan      html  css  js  c++  java
  • Grunt 入门指南4:创建插件

    Creating plugins 创建插件

    1. 使用npm install -g grunt-init安装 grunt-init
    2. 通过 git clone git://github.com/gruntjs/grunt-init-gruntplugin.git ~/.grunt-init/gruntplugin安装gruntplugin模版
    3. 在一个空目录中执行grunt-init gruntplugin
    4. 在准备好的开发环境中执行npm install
    5. 给你的plugin写上作者信息
    6. 执行npm pbulish发布你的grunt plugin到npm中!

    Notes 注意

    Naming your task

    “grunt-contrib”命名空间是grunt team的保留名称,请给自己的plugin做适当命令避免冲突

    Debugging 调试

    Grunt 默认情况下会隐藏错误调用栈跟踪功能,可以通过--stack选项来开启.如果你希望grunt总是log错误,你可以在你的shell里建一个alias,比如在你的bash中执行alias grunt='grunt --stack.

    Storing task files 存储task文件

    只把存储的文件放在项目的根目录下的.grunt/[npm-module-name]/目录中,并在适当的时候清理掉.对于临时文件来说,这不是一个解决方案,在这种情况下应该使用公用的npm模块(比如 temporay,tmp)来使用操作系统级别的临时目录.

    Avoid Changing the Current Working Director: process.cwd() 避免改变当前工作目录

    默认情况下,当前工作目录即为gruntfile的父目录.用户可以使用gruntfile中的grunt.file.setBase()来修改,但是plugin不应该改变它.path.resolve('foo')可以用来得到'foo'的绝对路径相对于gruntfile文档.

  • 相关阅读:
    CTF-Reverse-[GXYCTF2019]luck_guy
    凸度偏差与收益率曲线
    【翻译】理解 LSTM 网络
    基于 Keras 用 LSTM 网络做时间序列预测
    AIMR 固定收益推荐读物
    基于 Keras 用深度学习预测时间序列
    预测美国债券回报
    久期增加会提高长期预期回报吗?
    市场收益率预期与远期收益率
    sql server 查询时会锁表吗?
  • 原文地址:https://www.cnblogs.com/zhepama/p/3081078.html
Copyright © 2011-2022 走看看