Tag: gruntjs

为什么Grunt失败?

在运行npm run-script grunt之后,我得到一个奇怪的错误,它告诉我node_modules/.bin/grunt失败。 我正在跟随一个教程作为即时通讯相当新的Backbone( http://dailyjs.com/2012/11/29/backbone-tutorial-1/ ), 这是我的package.json文件。 { "name": "btask" , "version": "0.0.1" , "private": true , "dependencies": { "requirejs": "latest" , "connect": "2.7.0" } , "devDependencies": { "mocha": "latest" , "chai": "latest" , "grunt": "latest" , "grunt-exec": "latest" } , "scripts": { "grunt": "node_modules/.bin/grunt" } } 这里是完整的错误logging。 0 info it worked if it ends […]

grunt watch任务阻止命令行

我是新来的,还在学习,所以我遇到了一个很奇怪的问题。 当我运行"watch"任务时,我的命令行被阻塞,所以基本上我无法做任何事情。 不要忘记,任务是成功完成的。 这是我的命令行输出: C:\server\css-test>grunt w Running "watch" task Waiting…OK >> File "compass-examples-master\02\sass\screen.scss" changed. Running "compass" (compass) task unchanged compass-examples-master/02/sass/ie.scss unchanged compass-examples-master/02/sass/print.scss overwrite compass-examples-master/02/stylesheets/new/sass/screen.css Running "watch" task Completed in 1.496s at Fri Mar 22 2013 19:31:37 GMT+0100 (Central Europe Standard Time) – Waiting… 正如你所看到的,我所做的就是运行"compass"任务,它成功完成。 插入点在Waiting…文本部分后保持闪烁,但键盘input不起作用。 我的咕噜configuration module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), compass: […]

grunt bower安装一个shimmed凉亭依赖

我已经安装了一些我的应用程序需要的Git仓库,我做了以下操作: bower install git://github.com/user/cooltool.git –save grunt bower-install 然后我得到以下错误: cooltool was not injected in your file. Please go take a look in "app/bower_components/cooltool" for the file you need, then manually include it in your file. 是从一个GitHub仓库直接安装的鲍尔组件总是需要手动添加到我的index.html文件? 如果没有,我如何使它包含正确的脚本? Grunt任务都是yo angular-fullstack脚手架工具的一部分。 gruntfile的bower-install任务如下: // Automatically inject Bower components into the app 'bower-install': { app: { html: '<%= yeoman.app %>/views/index.html', […]

通过Grunt运行Node应用程序

我试图运行我的节点应用程序作为一个Grunt任务。 但是,我需要将其作为一个subprocess产生,以允许我并行运行watch任务。 这工作: grunt.registerTask('start', function () { grunt.util.spawn( { cmd: 'node' , args: ['app.js'] }) grunt.task.run('watch:app') }) 但是,当监视任务检测到更改时,这将再次触发启动任务。 在我生成Node应用程序的另一个subprocess之前,我需要杀死前一个进程。 但是,我不知道如何杀死这个过程。 像这样的东西不起作用: var child grunt.registerTask('start', function () { if (child) child.kill() child = grunt.util.spawn( { cmd: 'node' , args: ['app.js'] }) grunt.task.run('watch:app') }) 看起来: 尽pipe我将生成的进程存储在函数上下文之外的variables中,但它不会保留,所以下次启动任务运行时,child是undefined 。 child没有killfunction…

运行grunt-bower抛出_.object不是函数错误

我正在尝试运行grunt-bower任务来复制所有的bower组件。 Running "bower:dev" (bower) task TypeError: _.object is not a function at Object.exports.getDests (/Users/wonoh/cocApp/node_modules/grunt-bower/tasks/lib/helpers.js:131:14) at /Users/wonoh/cocApp/node_modules/grunt-bower/tasks/bower.js:63:35 at Array.forEach (native) at /Users/wonoh/cocApp/node_modules/grunt-bower/tasks/bower.js:59:21 at /Users/wonoh/cocApp/node_modules/grunt-legacy-util/node_modules/lodash/lodash.js:4040:15 at baseForOwn (/Users/wonoh/cocApp/node_modules/grunt-legacy-util/node_modules/lodash/lodash.js:2573:24) at /Users/wonoh/cocApp/node_modules/grunt-legacy-util/node_modules/lodash/lodash.js:4009:18 at Function.forEach (/Users/wonoh/cocApp/node_modules/grunt-legacy-util/node_modules/lodash/lodash.js:7634:11) at LodashWrapper.object.(anonymous function) [as each] (/Users/wonoh/cocApp/node_modules/grunt-legacy-util/node_modules/lodash/lodash.js:13501:25) at Logger.<anonymous> (/Users/wonoh/cocApp/node_modules/grunt-bower/tasks/bower.js:37:17) at emitOne (events.js:90:13) at Logger.emit (events.js:182:7) at Logger.emit (/Users/wonoh/cocApp/node_modules/bower-logger/lib/Logger.js:29:39) at /Users/wonoh/cocApp/node_modules/bower/lib/commands/list.js:75:16 at _fulfilled (/Users/wonoh/cocApp/node_modules/q/q.js:798:54) at […]

如何设置Gruntfile在heroku上使用指南针/ sass?

我已经用grunt buildpack成功设置了我的heroku应用程序。 当我将我的Node.js应用程序推送到heroku时,它将运行适当的grunt任务。 我想要的是使用“grunt-contrib-compass”包来编译我的.scss文件。 但是那需要指南针的可执行文件,我不知道该怎么做。 我已经检查过heroku文档,并且看到过时的文档描述了用ruby设置指南针 …但是我还没有看到任何最近的文档用于设置Node.js。 有任何想法吗?

通过bower安装jQuery-Mobile

在我的项目中,我想通过凉亭使用jquery-mobile。 在我可以使用它之前,我必须在bower_components/jquery-mobile之后运行npm install和grunt然后才能使用缩小的.js和.css文件。 这是非常乏味的,如果我不得不为每个使用的库都做这个,我想我会后退到下载文件并将它们添加到我的项目中。 那么有没有更优雅的方式通过鲍尔依赖关系到达这些“最终”文件? 我的bower.json "dependencies": { … "jquery-mobile": "latest", }

通过一个咕噜任务更新json文件中的文件引用

我是一名JavaScript开发人员,从头开始创build构build过程相当新颖。 我select使用Grunt来处理当前的项目,并且创build了一个GruntFile,这个GruntFile约占我需要的90%,除了这个问题之外,它工作的很好。 我有几个JavaScript文件,我在manifest.json文件中开发chrome扩展时引用。 对于我的构build过程,我连接所有这些文件,并将其缩小到一个文件,以包含在manifest.json 。 有没有在生成过程中更新manifest.json文件中的文件引用,所以它指向缩小版本? 这是src清单文件的一个片段: { "content_scripts": [{ "matches": [ "http://*/*" ], "js": [ "js/lib/zepto.js", "js/injection.js", "js/plugins/plugin1.js", "js/plugins/plugin2.js", "js/plugins/plugin3.js", "js/injection-init.js" ] }], "version": "2.0", } 我有一个长长的任务,将上面列出的所有js文件连接并缩小到一个名为inject.js的文件中,并且想要一个可以修改清单文件的grunt任务,如下所示: { "content_scripts": [{ "matches": [ "http://*/*" ], "js": [ "js/injection.js" ] }], "version": "2.0", } 我现在所做的是有两个版本的清单文件,一个用于开发,另一个用于构build,在构build过程中,它复制构build版本。 这意味着我需要保持2个版本,我宁愿不要做。 有没有办法更好地与Grunt做这个?

在Docker容器内部或外部运行Grunt / Gulp?

我试图找出一个良好的做法,使用grunt / gulp部署在Docker容器内的nodejs应用程序的构build过程。 我很满意以下顺序: 在容器外部使用grunt(或gulp)构build 将./dist文件夹添加到容器 在容器内运行npm install(带–production标志) 但在每一个我发现的例子中,我看到了一个不同的方法: 将./src文件夹添加到容器 在容器内运行npm install(使用dev依赖) 在容器内运行凉亭安装(如果需要的话) 在容器内部运行grunt(或gulp) 国际海事组织,第一种方法生成一个更轻,更有效的容器,但所有的例子都在使用第二种方法。 我错过了什么吗?

我可以在我的代码组织项目中有多个gruntjs文件吗?

我为我的项目使用gruntjs,并想知道是否有可能在我的项目中有多个grunt.js文件? 我问的原因是我的项目是这样组织的: grunt.js | |- project1 | | | |-grunt.js | |- project2 | |- project3 (etc..) 我想要顶级的grunt.js来构build所有的项目。 但随着项目列表的增长,我不希望我的顶级grunt.js文件变得巨大。 所以我想组织它,以便最高级的咕噜声可以调用项目级咕噜文件来构build它们。 或者如果有人想要构buildproject1,他们可以到project1文件夹并运行它自己的grunt.js。 可以这样做吗? 如果是这样,我该如何调用其他grunt文件? 如果没有,那么除了拥有一个巨大的grunt.js文件之外,还有什么其他解决scheme? 谢谢。