Tag: gruntjs

不能用maven运行npm grunt bower

我有一个简单的networking应用程序,使用npm鲍尔和咕噜声。 我正在使用这个项目作为maven项目中的一个模块。 我search了互联网,发现如何定义项目的pom.xml,但我无法运行它。 任何人都可以告诉我如何使用maven构build和运行webapp的步骤。 pom.xml <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.5.0</version> <executions> <execution> <id>exec-npm-install</id> <phase>generate-sources</phase> <configuration> <executable>npm</executable> <arguments> <argument>install</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> <execution> <id>exec-bower-install</id> <phase>generate-sources</phase> <configuration> <executable>bower</executable> <arguments> <argument>install</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> <execution> <id>exec-grunt</id> <phase>process-resources</phase> <configuration> <executable>grunt</executable> </configuration> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 我得到的错误是 [ERROR] Command […]

将stdout彩色输出传递给grunt输出

我正在尝试创build一个运行mochatesting的grunt自定义任务,但我无法弄清楚如何让grunt从mocha获取彩色输出,并以直接运行mocha命令的方式显示它。 即:咕噜出去的颜色或不通过他们通过。 这是咕噜的任务: var exec = require("child_process").exec; grunt.registerTask('mocha', 'Run unit (Mocha) tests.', function () { var done = this.async(); var cmd = "mocha -R Spec tests/mocha/*.js"; exec(cmd, function (error, stdout, stderr) { if (stdout) { grunt.verbose.or.write(stdout); done(); } }); }); 我意识到有一个我可以使用(和使用)的grunt-mocha插件,但我试图消除依赖关系,也将在这个任务上做一些定制。 谢谢!

Grunt失败生成“path.join的参数必须是string”错误

更新到节点0.10.0,现在当Grunt服务器仍然工作时,Grunt(build)和Grunt Test在运行“useminPrepare:html”(useminPrepare)任务时返回“path.join的参数必须是string”错误,有效地失败。 设置:节点:0.10.0 Yeoman:1.0.0-beta.3 Grunt:grunt-cli v0.1.6,grunt v0.4.0rc7 我知道有一些修复,但尝试所有build议的解决scheme(npmcaching清除,Grunt重新安装等)没有成功。 任何帮助赞赏。

Node / Grunt – Autoprefixer – 如何添加configuration到我的Gruntfile.js&如何检查支持的浏览器?

我想开始使用名为autoprefixer的CSS后处理器( https://github.com/ai/autoprefixer )。 经过一番杂耍,我实际上得到了这个工作,这对我来说是相当了不起的,因为我是一个绝对的节点,咕噜声和terminal初学者。 在autoprefixer文档中说,可以configuration哪些浏览器支持,作为解释这行代码给出: autoprefixer("last 1 version", "> 1%", "ie 8", "ie 7").compile(css); 但是我把这个代码放在哪里? 我试图把它粘贴到我的Gruntfile的底部而没有成功。 该文件如下所示: module.exports = function (grunt) { grunt.initConfig({ autoprefixer: { dist: { files: { 'build/style.css': 'style.css' } } }, watch: { styles: { files: ['style.css'], tasks: ['autoprefixer'] } } }); grunt.loadNpmTasks('grunt-autoprefixer'); grunt.loadNpmTasks('grunt-contrib-watch'); }; 我也试着像这样添加它: autoprefixer: { options: { browsers: ["last […]

是否可以在yeoman生成器安装后运行grunt命令?

基本上我想在我的生成器完成安装依赖关系后运行grunt ,我发现你可以添加一个callback函数到installDependencies方法中,在所有事情都被安装完成后运行: this.on('end', function () { this.installDependencies({ skipInstall: options['skip-install'], callback: function () { console.log('All done!'); } }); }); 但是我不知道如何运行这个grunt任务(就像去往terminal并运行“grunt”一样)

WebStorm 7 – Yeoman Angular丢失的源映射`加载资源失败:服务器响应状态为404(Not Found)

使用WebStorm 7.0.1运行yeomanangular发生器grunt服务器抛出: Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/jquery/jquery.js.map:0 Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/angular/angular.js.map:0 Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/bootstrap-affix.js.map:0 Failed to load resource: the server responded with […]

命令“grunt server”的罗盘错误

我正在运行一个项目,我安装了nodeJs,ruby,yeoman,compass等。现在我正在用命令>grunt server或>grunt server –force运行我的项目 但它给我指南针的错误。 E:\CRM_workspace\CRM_from_repo\ria>grunt server –force Running "server" task >> The `server` task has been deprecated. Use `grunt serve` to start a server. Running "serve" task Running "clean:server" (clean) task Cleaning .tmp…OK Running "concurrent:server" (concurrent) task Running "copy:styles" (copy) task Done, without errors. Running "compass:server" (compass) task directory .tmp/styles/ create .tmp/styles/main.css (3.069s) Warning: […]

当主机是0.0.0.0时,grunt-connect不工作

我试图从外部访问使用grunt-contrib-connect插件创build的本地node.js开发服务器。 当我使用localhost或127.0.0.1作为hostname参数时,服务器工作(在本地)。 但是,当我将参数更改为*或0.0.0.0以允许外部访问(如文档中指定)时,我无法在本地或外部访问服务器; 这是我在Chrome中得到的错误: 我已经尝试禁用我的防火墙,我可以看到数据包从我的手机进入正确的端口(我用来尝试从外部访问我的本地服务器)。 任何想法为什么它不能使用*或0.0.0.0作为hostname ?

如何运行grunt docular-server?

如果我执行grunt docular-server命令 我收到错误消息: ERROR: Could not start node server [TypeError: Object #<Object> has no method 'server'] 那么docular-server没有运行。 我安装了grunt来编写我的代码的文档,如下所示: `npm install -g grunt-cli` `npm install grunt grunt-docular` 我的Gruntfile.js看起来像这样: module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), docular: { groups: [], showDocularDocs: true, showAngularDocs: true } }); // Load the plugin that provides the "docular" […]

grunt:找不到命令

npm知道grunt是全球安装的,为什么不能find? $ npm install -g grunt … installs … $ npm list -g | grep grunt │ ├─┬ gruntfile-editor@0.2.0 │ ├─┬ gruntfile-editor@0.2.0 ├─┬ grunt@0.4.5 │ ├─┬ grunt-legacy-log@0.1.1 │ ├── grunt-legacy-util@0.2.0 $ grunt -bash: grunt: command not found 我认为是因为它把它放在我的path上的某个地方。 为什么npm只是把它放在我的PATH默认的地方,比如/usr/local/bin ? 更新:奇怪的是,即使在我执行npm install grunt在本地运行之后,我也得到了同样的grunt: command not found错误。 我究竟做错了什么? 在我的回购中有一个Gruntfile.js 。