【问题标题】:Local portable grunt distribution?本地便携式 grunt 分发?
【发布时间】:2014-01-21 03:13:26
【问题描述】:

我目前正在使用嵌入了 node.js 的 Node-Webkit 创建我的工作流的可移植整合。现在我的问题是项目本身内部的 grunt/gulp,因为它在某种程度上取决于 cli(可避免,授予),并且在架构上也让我感到困惑。是否有可能只找到一个包含 grunt 的 .js 来包含类似于 Jquery/Handlebars 的内容?

Is this all I need to just include and run?

【问题讨论】:

  • grunt-cli 是唯一不容易移植的东西,因为您必须将其添加到路径中

标签: html node.js gruntjs


【解决方案1】:

在此之前确保你的环境已经启动,获取 package.json, GruntFile.js 文件。在 GruntFile.js 中,您可以指定要预处理的内容。例如 jade,Less,coffee。看起来很像一个节点函数,示例可以参考link

现在要完成这项工作,您还需要根据您的要求安装各种 contrib 插件。然后在 GruntFile.js 中注册每个任务。它确实加快了开发速度。

  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.registerTask('test', ['jade', 'less','coffee']);

所以要处理less,jade,coffee,我们需要运行诸如

之类的模块安装
npm install grunt --save-dev    
npm install grunt <module name> --save-dev

还有很多有趣的配置可以学习,文档非常好,请参考getting started guide 这会将所需的 Grunt 和 grunt 插件添加到 package.json

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-01
    • 2011-01-12
    • 2018-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-11
    相关资源
    最近更新 更多