Tag: gruntjs

在客户端不使用npm部署node.js项目

我想要频繁更新部署一个nodejs项目。 npm在站点不可用,所以我必须打包node_modules。 这工作正常,但需要很长时间才能通过可用的ftp连接发送给客户(每次80MB大部分node_module文件)。 我的工作stream程如下所示: git clone project npm install # installs all my dev tools which I need for packaging grunt build tar xvzf build.tar.gz build/ 构build步骤简化了我的代码打包只需要什么。 node_modules文件夹被复制到build文件夹中。 如果我使用npm install –production ,我可以获得更小的占用空间,但却无法摆脱首先构build它的工具。 所以最后,我花了一些努力使我的代码足迹小,但我的工作是通过打包如此大的node_modules树来取消。 我的方法错了吗? 有没有一种更简单的方法来部署npm在生产服务器上不可用或是否有减lessnode_modules文件夹大小的好方法?

从Gruntfile.js迁移到gulpfile.js

我正在尝试使用grunt2gulp.js工具将多个用grunt设置的项目迁移到gulp中。 但是,我不确定如何继续。 工具grunt2gulp.js似乎是一个简单的方法来启动,但我遇到的问题是,我不能得到它的工作。 由于没有npm install -g grunt2gulp ,我有点不确定我需要做什么才能在全局安装项目并能够访问它。 github repo上的readme.md没有指定如何安装项目。

如何使用Grunt的stylelint?

我试图用stylelintreplacegrunt-scss-lint (因为它的Ruby依赖性和没有安装gem的无提示失败)。 我遇到的问题是以下错误: $ grunt Loading "Gruntfile.js" tasks…ERROR >> ReferenceError: Map is not defined 我认为这是因为stylelint(这是一个PostCSS插件,而不是一个Grunt插件)需要ES6。 这是抛出Map is not defined错误的代码。 有没有办法让这个工作,我可以运行grunt而不是像这样一些奇怪的解决方法?

grunt.task.run()不起作用

我试图在我的快速应用程序中使用咕噜声。 我有这样的东西: var grunt = require('grunt'); require(process.cwd() + '/gruntfile.js')(grunt); grunt.task.run('development'); 但是这个任务似乎不是什么东西。 (没有错误输出到控制台)但是,如果我直接在控制台“咕噜发展”运行正常。

航行js运行testing

我试图运行我的帆unit testing(使用摩卡和伊斯坦布尔) 运行时 grunt test 我得到的错误 1) "before all" hook 2) "after all" hook 0 passing (5s) 2 failing 1) "before all" hook: Error: timeout of 2000ms exceeded at null.<anonymous> (/vagrant/node_modules/mocha/lib/runnable.js:157:19) at Timer.listOnTimeout [as ontimeout] (timers.js:112:15) 2) "after all" hook: ReferenceError: sails is not defined 设置似乎没有find我的风帆,但是在做 which sails 我明白了 /usr/local/node/node-default/bin/sails 并运行sails lift工作正常 这是我的项目中的摩卡testing文件 //boostrap.test.js var […]

没有代理可以find以下function:咕噜

当我尝试在本地TFS 2015 Update 1上排队构build时,出现以下错误消息: 没有代理可以find以下function:咕噜 我已经安装了NodeJS和grunt-cli并且它们正在path中 (即它们可以从任何位置以cmd执行)。 我错过了什么?

Gruntjs改变下划线模板分隔符

我试图生成一个JSP页面,由于JSP使用的模板分隔符与下划线使用的模板分隔符相同。 看文档 – > https://github.com/gruntjs/grunt/wiki/grunt.template#wiki-grunt-template-setDelimiters我可以看到他们有一个function grunt.template.addDelimiters(name, opener, closer) 两个问题: 我在哪里可以调用该function? 我可以更改分隔符只为一个grunt.template.process() (我有多个,并为其他非.jsp模板,默认的分隔符是好的)? 任何帮助表示赞赏。 谢谢。

没有Java的JSDoc?

我正在尝试将J SDoc合并到我的Grunt部署过程中。 当我运行它,我得到以下错误(预期): >> JAVA_HOME is not set. Jsdoc requires Java to run. Fatal error: Bad argument 我知道JSDoc是基于Java的,但我希望完全从等式中删除Java。 有没有办法做到这一点与现有的grunt插件,或者另一个只在Node中运行的过程? 我不想只为一个任务添加Java。 这是一个傻瓜的差事吗?

我怎样才能dynamic生成一个文件名列表,用于与Grunt任务?

我正在使用load-grunt-config和grunt-prompt ,并且正在开发一个init任务,它在两个文件夹之间复制一些php模板。 现在的模板文件名是硬编码的,但我宁愿有grunt扫描正确的文件夹,并提供dynamic的文件名。 我试过使用grunt.file.expand ,但我无法得到它的工作。 是否有可能扫描一个文件夹,并返回一个数组(或对象,不知道你会怎么称呼它)的文件名格式grunt-prompt所期待的? // ————————————- // Grunt prompt // ————————————- module.exports = { // —– Initialization prompt —– // init: { options: { questions: [{ // Set the authors name config: 'init.author.name', type: 'input', message: 'What is your name?' }, { // Set the name of the project config: 'init.project.name', type: 'input', […]

nodejs gruntsubprocesscallback函数的例子

你会好心帮助下面一个节点执行命令运行与咕噜的例子? echo命令正在执行,并且创build了hello-world.txt ,但callback函数中的grunt.log.writeln命令不会触发。 var exec = require('child_process').exec, child; child = exec('echo hello, world! > hello-world.txt', function(error, stdout, stderr){ grunt.log.writeln('stdout: ' + stdout); grunt.log.writeln('stderr: ' + stderr); if (error !== null) { grunt.log.writeln('exec error: ' + error); } } ); 参考文献: http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options 从节点subprocess中检索一个值