Tag: gruntjs

如何防止grunt-nodemon重新启动所有应用程序

我在Windows 10上运行节点。我有三个节点应用程序,我希望能够用一个方便的grunt命令启动它们。 此外,我希望节点自动重新启动,如果我修改任何应用程序。 我正在使用grunt-nodemon和grunt-concurrent的组合。 节点进程全部启动正常。 问题是,如果我修改相关的代码,他们都重新启动,这需要很长的时间。 我怎样才能使nodemon只重新启动其实际修改的代码的应用程序? var loadGruntTasks = require('load-grunt-tasks') module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concurrent: { runAll: { tasks: ['nodemon:app1', 'nodemon:app2', 'nodemon:app3'], options: { logConcurrentOutput: true } } }, nodemon: { app1: { script: './app1/app.js' }, app2: { script: './app2/app.js' }, app3: { script: './app3/app.js' } } }) loadGruntTasks(grunt) grunt.registerTask('default', ['concurrent:runAll']) […]

grunt-include-source不起作用

我尽量简单地使用 – grunt-include-source,但是我没有成功 – 我的Gruntfile是 – module.exports = function (grunt) { grunt.initConfig({ includeSource: { options: { basePath: 'app/file1.js' }, myTarget: { files: { 'dist/index.html': 'app/index.html' } } } }); grunt.loadNpmTasks('grunt-include-source'); grunt.registerTask('serve', function (target) { grunt.task.run('includeSource'); }); } index.html是 – <html> <head> </head> <body> <!– include: "type": "js", "files": "scripts/*.js" –> </body> </html> 我的文件夹层次是 – Gruntfile.js […]

grunt-injector不注入文件

我正在使用grunt-injector来注入客户端依赖项。 以下是我的initConfig的“注入器”部分的外观: "injector": { "options": { "template": "public/dist/index.html", "destFile": "public/dist/index.gen.html" }, "local_dependencies": { "files": { "public/dist/index.html": [ "public/**/*.js", "public/**/*.css" ] } } } 和我的公共/ dist / index.html读取 <!DOCTYPE html> <html> <head> <!– injector:css–> <!– endinjector–> </head> <body ng-cloak ng-app="primary"> <!– injector:js–> <!– endinjector–> </body> </html> 我做到了 grunt.loadNpmTasks("grunt-injector"); 并注册“注射器”作为我的任务的一部分。 但是,执行grunt只会生成,而不是注入。 到“index.gen.html”文件。 我该怎么办? 有什么build议么?

我正在得到问题phantomjs和业力

我在运行咕噜声时遇到问题,它引发了以下问题: 错误[启动]:PhantomJS2失败2次(超时)。 放弃。 DEBUG [karma]:运行完成,退出。 DEBUG [启动器]:断开所有浏览器 警告:任务“业力:连续”失败。 使用–force继续。 我试图运行npm install phantomjs 这是成功的。 之后,我运行npm install ,以及再次获得上述问题

Grunt:加载依赖需要几分钟的时间

我已经把一些相当标准的grunt任务与合理数量的依赖放在一起,但由于某些原因,实际加载依赖需要1-3分钟。 我是一个咕噜咕噜的新手,但是因为大多数关于极端缓慢加载咕噜声依赖的其他问题引用了几秒钟的时间,所以我猜测我正在做一些非常错误的事情。 这是我的gruntfile的样子: const path = require("path"); module.exports = function(grunt) { require('jit-grunt')(grunt); require('time-grunt')(grunt); const ignoredSourceScriptPatterns = ['!**/*.debug.js', '!**/*.min.js', '!scripts/*', '!**/*.map'], baseUIPath = 'presentation/ui', scripts = grunt.file.expand({filter: 'isFile', matchBase: true, cwd: baseUIPath}, ['*.js', …ignoredSourceScriptPatterns]); // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), copy: { build: { cwd: 'presentation/', src: 'ui/**', dest: path.join('presentation', 'static'), expand: true } }, uglify: […]

Grunt – 如何更新js文件中使用gruntcaching胸围的HTML文件引用?

在我的js文件中,我引用了HTML文件,比如window.location。 我想gruntcaching破坏更新该引用并添加散列数据,所以加载的页面是正确的,使用正确的版本文件。 例如: window.location ='myweb.html'; > window.location ='myweb.html?575a2aa1158af941?575a2aa9658af941'; 我无法find任何configuration的caching半身像允许我在js文件中写入。 在我的Gruntfile.js中,我添加了必须写入的资产和scr文件,但没有成功。

根据参数dynamic安装节点包

我需要dynamic更新node.js package.json,例如,如果我运行npm start,它将会安装param A. 例如,如果我运行npm start A,它会启动 { "name": "simplenodeapp", "main": "app.js", "scripts": { "start": "node app.js" <some param", }, "license": "ISC", "dependencies": { "express":"*" }, } 如果我运行npm start B { "name": "simplenodeapp", "main": "app.js", "scripts": { "start": "node app.js" <some param>", }, "license": "ISC", "dependencies": { "HAproxy":"*" }, } 可能吗 ? 我需要以编程方式执行…

如何使用gruntjs连接string和文件

使用grunt可以连接string吗? 我知道我可以像这样连接<banner> : concat: { dist: { src: [ '<banner>', '<file_strip_banner:public/src/js/lib/underscore.js>', '<file_strip_banner:public/src/js/lib/jquery.js>' ], dest: 'public/js/all.js' } } 但是当我在meta声明其他variables时,他们只是被忽略。 谢谢

从bash脚本调用grunt.js时遇到问题

当我呼吁grunt(https://github.com/gruntjs/grunt),从grunt.js相同的目录,它工作正常。 但是,如果我尝试使这种名为“build.sh”的bash脚本: #!/bin/bash `grunt grunt.js` 而当我打电话./build.sh它给出了以下错误: ./build.sh:第2行:Running:找不到命令 我试图指定完整path咕噜,也试图指定完整pathgrunt.js文件与configuration,但它不想工作:( 我错过了什么?

使用jasmine和grunt对多个版本的jquery进行testing

我已经写了一个jQuery插件的茉莉花testing,我想自动testing我声称支持的每个版本的jQuery。 我已经设置了使用grunt-jasmine-runner运行单个版本的jquery的testing,但是我怎样才能多次运行jasmine任务,每个版本的jquery一次呢? 也可以用qunit吗?