gruntjs

How can I make a Grunt task fail if one of its sub tasks fail?

久未见 提交于 2019-12-12 19:42:29
问题 I have a build task in grunt, which looks like this: grunt.registerTask("build", ["jshint", "uglify"]); The problem is that the uglify task runs even if the jshint task fails, how can I make the 'build' task terminate if one of it's sub tasks fails? 回答1: The default behavior in Grunt is to not run subsequent tasks if one fails. So you must be using the force option somewhere. You are either: 1 - passing --force on the command line 2 - calling grunt.option( 'force', true ); somewhere 3 - have

Grunt watch less on changed file only

↘锁芯ラ 提交于 2019-12-12 18:11:23
问题 I want to have a gruntfile with 2 tasks: less (compiles all less files) and watch (listens to changes and re-compiles the changed file). I have the following Gruntfile.js: module.exports = function(grunt) { var files = [ { expand: true, cwd: 'media/less', src: ['*.less'], dest: 'media/css/', ext: '.css' }, { expand: true, cwd: 'media/less/vendor', src: ['*.less'], dest: 'media/css/vendor/', ext: '.css' }, { expand: true, cwd: 'media/admin/less', src: ['*.less'], dest: 'media/admin/css/', ext:

Grunt Server and WebStorm javascript debugging (and SpyJS) not working

眉间皱痕 提交于 2019-12-12 16:25:25
问题 I have an app that I made with yeoman, grunt an angular JS (typical setup - image included below). I'm trying to debug my project with spyjs (or even regular javascript debugging) but I can't seem to get it working when I run "grunt serve" - the file that's loaded from WebStorm clearly isn't going through the grunt server (but localhost:63343 instead). Any ideas how I could configure things properly to get debugging to work? Here's my SpyJS configuration: I've also tried localhost:9000 for

Grunt Concurrent cannot run too many tasks

流过昼夜 提交于 2019-12-12 15:09:58
问题 I'm trying to run multiple watch tasks with grunt, but it seems to not be able to. I'm using grunt concurrent, but it seems to only run a portion of the tasks I specify, stopping just short. Here is the snippet of my gruntfile: concurrent: compile: tasks: ["watch:app", "watch:html", "watch:images", "watch:lib", "watch:server"] options: logConcurrentOutput: true When I run this, the output shows: Running "concurrent:compile" (concurrent) task Running "watch:images" (watch) task Waiting..

Prompt for input in using the grunt-shell plugin

我只是一个虾纸丫 提交于 2019-12-12 14:08:59
问题 I have a script I am trying to run with grunt using the grunt-shell plugin. This script prompts for input using read -p "enter foo" bar . When I run it, I get a cursor that correctly takes my input, but I don't see "enter foo". I tried modifying the grunt-shell config to dump err, stderr, and stdout to the console, but they all come out empty once the command completes. The man page for read says about the -p flag "The prompt is displayed only if input is coming from a terminal.", which seems

Errors while running Grunt build for the first time

做~自己de王妃 提交于 2019-12-12 12:25:50
问题 I created an angularJS project using Yeoman Previewing the app using grunt serve works well. The server starts and I can browse my pages successfully. When executing grunt build I am getting Running "cdnify:dist" (cdnify) task Going through dist/404.html, dist/index.html to update script refs >> No "cssmin" targets found. Warning: Task "cssmin" failed. Use --force to continue. Aborted due to warnings. Which I dont know how to fix, or how to begin. Am I missing some configurations?

How do I get a grunt project's version from command line?

匆匆过客 提交于 2019-12-12 12:18:27
问题 I'm looking to integrate my grunt project with TeamCity continuous integration server. I need a way to make the package name that TeamCity generates contain the project's version number, that is found in package.json in the root of the project. I can't seem to find a grunt command that provides this, and am resorting to using grep. Is there an undocumented way of getting a grunt project's version from the command line? 回答1: So in Grunt you can do something like this: module.exports = function

How to run protractor?

匆匆过客 提交于 2019-12-12 11:13:47
问题 I'm very new to protractor. I am running this in Windows command line. I followed the this tutorial https://github.com/angular/protractor/blob/master/docs/getting-started.md I sucessfully run npm install -g protractor I don't know how to run this node_modules/protractor/bin/install_selenium_standalone If I run this straight away in command line. I am getting this error 'node_modules\protractor\bin\install_selenium_standalone' is not recognized as an internal or external command, operable

Grunt watch tasks seem to take a very long time

本小妞迷上赌 提交于 2019-12-12 10:36:42
问题 I'm running two simple tasks that run for <100ms each but when run under the watch command the two combined tasks are taking ~8 seconds in total (there seems to be an overhead of 3.5 seconds per task). I'm using it with live-reload for development and I'm finding it very frustrating. I tried setting spawn to false but this seemed to break it and none of the associated tasks were run. Here's sample output from when a sass file is changed. >> File "app/styles/main.scss" changed. File "app

Understanding r.js options w/grunt & backbone and relative paths

梦想的初衷 提交于 2019-12-12 09:57:07
问题 I'm trying to figure out how to use r.js. I keep getting errors thrown such a module path does not exist, or files getting dumped where they shouldn't be. I've got a single page application that is integrated with wordpress. I've adopted this backbone boilerplate for my general structure, although I've set things up quite different. My file structure is shown below. .Theme Folder ├── _assets | ├── _application | | ├── css | | ├── fonts | | ├── img | | ├── _js | | | ├── main.js //this is my