Questions tagged [gruntjs]
Grunt is a task-based command line build tool and task runner for JavaScript projects.
gruntjs
9,098
questions
2075
votes
7
answers
310k
views
NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack [closed]
I'm trying to summarize my knowledge about the most popular JavaScript package managers, bundlers, and task runners. Please correct me if I'm wrong:
npm & bower are package managers. They just ...
628
votes
2
answers
190k
views
Difference between Grunt, NPM, and Bower (package.json vs bower.json)
When I want to add a package (and check in the dependency into git), where does it belong - into package.json or into bower.json?
From what I gather,
running bower install will fetch the package and ...
531
votes
7
answers
140k
views
Grunt watch error - Waiting...Fatal error: watch ENOSPC
Why do I get the Waiting...Fatal error: watch ENOSPC when I run the watch task ?
How do I solve this issue?
404
votes
13
answers
494k
views
What is causing this error - "Fatal error: Unable to find local grunt"
I removed the old version of grunt first, then I installed the new grunt version, and then I got this error:
D:\www\grunt-test\grunt grunt-cli: The grunt command line interface.
(v0.1.4)
...
367
votes
22
answers
383k
views
Cannot install NodeJs: /usr/bin/env: node: No such file or directory
I'm trying to install nodeJs into my Ubuntu 14.04 in order to use GruntJs.
I've read about Ubuntu different way of doing it (issues?), so this is what I've done in order to install it:
sudo apt-get ...
312
votes
8
answers
132k
views
What does --save-dev (or -D) mean in npm install grunt --save-dev?
I've just started using Grunt. It is pretty hard to set up and I am at the point of creating a package.json file.
Following this tutorial, it says there are 3 ways to create a package.json file.
The ...
267
votes
15
answers
319k
views
Replace a string in a file with nodejs
I use the md5 grunt task to generate MD5 filenames. Now I want to rename the sources in the HTML file with the new filename in the callback of the task. I wonder what's the easiest way to do this.
228
votes
6
answers
160k
views
How to tell if an npm package was installed globally or locally
I am installing Grunt, Node.js, npm, Bower, and grunt-cli on Windows 7.
The instructions say I should run the install commands with the -g flag for global.
How can I check if I used the -g flag when I ...
212
votes
1
answer
121k
views
What is the role of src and dist folders?
I'm looking at a Git repository for a jQuery plugin. I want to make a few changes for use in my own project, but when I opened up the repository it had a structure I've never seen before. I'm not sure ...
209
votes
12
answers
78k
views
Have Grunt generate index.html for different setups
I'm trying to use Grunt as a build tool for my webapp.
I want to have at least two setups:
I. Development setup - load scripts from separate files, without concatenation,
so my index.html would ...
125
votes
2
answers
23k
views
Task Runners (Gulp, Grunt, etc) and Bundlers (Webpack, Browserify). Why use together?
I am trying to learn about technologies including Grunt, Gulp, Webpack, Browserify, but I did not feel that there is much difference between them.
In other words, I feel Webpack can do everything that ...
122
votes
7
answers
85k
views
npm windows install globally results in npm ERR! extraneous
I am trying some "cookbook-examples" on the site 'http://tech.pro/tutorial/1190/package-managers-an-introductory-guide-for-the-uninitiated-front-end-developer#front_end_developers'.
You ...
109
votes
4
answers
132k
views
Karma: Running a single test file from command line
So, I've been looking all over for this, found "similar" answers here, but not exactly what I want.
Right now if I want to test a single file with karma, I need to do fit(), fdescribe() on the file ...
103
votes
6
answers
130k
views
grunt: command not found when running from terminal
I'm new to Grunt. I'm trying to configure Grunt on my Mac OSX Lion.
I followed the instructions here and then created a project folder that contains the files below. When I try to run by typing "...
102
votes
7
answers
27k
views
Using node-inspector with Grunt tasks
Does someone used node-inspector with Grunt for application debugging? If not, Can you recommend a debugging tool for Grunt based apps?
I'm working with nodejs for a server side app and I have Grunt ...
100
votes
2
answers
21k
views
What does the "expand" option do in grunt-contrib-copy? The examples all use it but the docs say nothing about what it does
Here is the README and examples: https://github.com/gruntjs/grunt-contrib-copy/blob/master/README.md.
Here is the relevant part of the code (that I apparently cannot understand) from https://github....
98
votes
6
answers
44k
views
No provider for "framework:jasmine"! (Resolving: framework:jasmine)
When I run the command grunt I get the following warning:
Running "karma:unit" (karma) task
Warning: No provider for "framework:jasmine"! (Resolving: framework:jasmine) Use --force to continue.
...
98
votes
5
answers
112k
views
How to concatenate and minify multiple CSS and JavaScript files with Grunt.js (0.3.x)
Note: This question is only relevant for Grunt 0.3.x and has been left for reference. For help with the latest Grunt 1.x release please see my comment below this question.
I'm currently trying to use ...
97
votes
6
answers
72k
views
Running a command in a Grunt Task
I'm using Grunt (task-based command line build tool for JavaScript projects) in my project. I've created a custom tag and I am wondering if it is possible to run a command into it.
To clarify, I'm ...
97
votes
5
answers
34k
views
Javascript web app and Java server, build all in Maven or use Grunt for web app?
We are doing a web application with AngularJS and we like the idea of using Bower for Dependency Management and Grunt for building, running tests etc. (Yeoman)
The server is done with Java using Maven,...
96
votes
5
answers
86k
views
Copy all files from directory to another with Grunt.js copy
I'm trying to copy all the files in a directory to another directory as part of my build process. It works fine for individual files that I specify explicitly but when I try to copy the whole ...
94
votes
4
answers
197k
views
How to install grunt and how to build script with it
Hi I'm trying to install Grunt on Windows 7 64 bit. I have installed Grunt using commands
npm install -g grunt
npm install -g grunt-cli
but now if I try to do grunt init, it is throwing me an ...
93
votes
2
answers
93k
views
ESLint's "no-undef" rule is calling my use of Underscore an undefined variable
I am using Grunt as my Build Tool and ESLint as my linting tool for an app I am working on. I am also using the Underscore Node package, and have made use of it in my app. Unfortunately, when I run ...
92
votes
10
answers
66k
views
How to upload file in angularjs e2e protractor testing
I want to test file uploading using an angularjs e2e test. How do you do this in e2e tests? I run my test script through grunt karma.
90
votes
6
answers
28k
views
grunt throw "Recursive process.nextTick detected"
I'm running Lion 10.9.2 with nodejs v0.10.26
I want to setup an automated compilation on sass files and a live reload with grunt, nothing complicated but...
When running grunt watch I get the ...
89
votes
2
answers
26k
views
List grunt.js tasks
I'm trying to work out how to print a list of all available grunt tasks. With rake it would be:
$ rake -T
What's the equivalent for grunt? e.g.
$ grunt -T
concat
jasmine
minify
81
votes
2
answers
48k
views
What is Grunt for?
I'm trying to get into Grunt, which I am new to, but I do not understand its utility.
I understand that it is a taskrunner. I understand that it can be used to do things like bundle, uglify, jshint, ...
77
votes
22
answers
119k
views
Tried to Load Angular More Than Once
I have a yeoman scaffolded app (the angular fullstack generator).
grunt serve works fine, but grunt build produces a distribution that locks up memory, most probably because of circular references ...
77
votes
1
answer
52k
views
grunt (minimatch/glob) folder exclusion
I have a situation where I'm trying to use grunt to lint a codebase, excluding specific folders.
grunt uses minimatch (similar to bsdglob) under the hood to match files, but I can't seem to figure ...
73
votes
7
answers
122k
views
"Fatal error: Unable to find local grunt." when running "grunt" command
I uninstalled grunt with following command.
npm uninstall -g grunt
Then I again installed grunt with following command.
npm install -g grunt-cli
Visit following link:
https://npmjs.org/package/...
69
votes
6
answers
115k
views
How to uninstall npm package?
I've installed grunt using sudo npm install grunt and now I can't remove it.
I've tried:
$ sudo npm uninstall grunt
But it gives me a WARN:
npm WARN uninstall not installed in /home/kuba/projects/...
68
votes
1
answer
37k
views
How grunt watch files in sub folders?
My code folders and files are like this, you never know how many sub folders in it:
js/sub1/a.js
js/sub2/b.js
js/sub3/sub31/c.js
js/sub4/sub41/sub411/d.js
Here is part of the Gruntfile.js:
grunt....
67
votes
5
answers
51k
views
How to compile .sass files on save in Visual Studio 2015
How can one get a full sass (i.e. scss) precompiler environment up and running in Visual Studio 2015? This is a sibling question to this one concerning less.
66
votes
1
answer
30k
views
Node glob pattern for every .js file except .spec.js
I am looking for a better glob pattern for usemin, i want to to find all .js files but exclude the .spec.js files. I have the following solution so far.
<script src="components/**/*(.js|!(*.spec....
65
votes
15
answers
47k
views
Fontawesome is not working when project is built with grunt
I'm using the font library font awesome. It works when the project is not built/uglified with grunt.
But when I'm building the project with grunt it's not working. I get this error in console: .../...
64
votes
2
answers
32k
views
what does grunt "test command" do on npm init
I'm trying to learn grunt. When I run npm init, I get a prompt in the process of creating a package.json file that asks for "test command" - I'm not sure how to utilize this, or what it's expecting. ...
63
votes
5
answers
30k
views
Automate npm and bower install with grunt
I have a node / angular project that uses npm for backend dependency management and bower for frontend dependency management. I'd like to use a grunt task to do both install commands. I haven't been ...
63
votes
3
answers
54k
views
What's the purpose of gruntjs server task?
I'm learning how to propel use gruntjs. I found the server task but I can't get the point.
Can i use the server task mapping concatenated/minified files to test my application (uses backbone.js) ...
62
votes
2
answers
31k
views
What's the difference between concat and uglify and minify?
What's the difference between concat, uglify, and minify tasks in grunt? I set up an uglify task for all of my site's javascript tasks, and it seemed to both minify and concatenate them. Grunt's site ...
59
votes
9
answers
33k
views
How to run two grunt watch tasks simultaneously
Is it possible to run two watch tasks simultaneously?
I understand that I can have any number of tasks I want inside watch settings and just launch grunt watch and it will watch all of them, like ...
58
votes
7
answers
29k
views
How to deploy node app that uses grunt to heroku
I'm using grunt and also grunt plugins like grunt-contrib-copy, grunt-contrib-mincss (that listed as npm dependencies for my application).
Also I don't commit npm_modules folder and public folder, ...
58
votes
11
answers
51k
views
how to config grunt.js to minify files separately
there are some js files in static/js/
1. a.js
2. b.js
3. c.js
how to config grunt.js to get below files:
1. a.min.js
2. b.min.js
3. c.min.js
as far, I have to type ...
57
votes
11
answers
72k
views
Grunt on Windows 8: 'grunt' is not recognized
I'm having a problem running Grunt from the command line on my Windows 8 machine.
My research indicates the most common solution is to install grunt-cli, since Grunt is no longer global. I also need ...
56
votes
17
answers
60k
views
Cannot find module 'internal/fs' after upgrading to node 7
We've recently tried to upgrade to node v7.0.0 on our build server, but started to have issues during the application build task failing on the "bower_concat" step:
Loading "bower-concat.js" tasks......
56
votes
7
answers
23k
views
How can I make Heroku install devDependencies?
I would like to have Heroku build my app after I push it so that I don't have to push the build folder up every time I make a change. However Heroku only installs the dependencies from the package....
53
votes
1
answer
46k
views
How to ignore files grunt uglify
Background
I've just started using grunt as of about 30mins ago. So bear with me.
But I have a rather simple script going that will look at my js and then compress it all into one file for me.
Code
...
53
votes
6
answers
15k
views
Grunt dependencies conflicts in Bootstrap
I've downloaded Bootstrap source files from the official website and I'm getting dependency conflicts when installing the project using node's npm. I have grunt 0.4.3 installed on my machine but some ...
52
votes
11
answers
167k
views
"No ESLint configuration found" error
Recently, we've upgraded to ESLint 3.0.0 and started to receive the following message running the grunt eslint task:
> $ grunt eslint
Running "eslint:files" (eslint) task
Warning: No ESLint ...
52
votes
6
answers
32k
views
How can I rename files with Grunt, based on the respective file's parent folder name?
I have a the following structure:
src/
modules/
module1/
js/
main.js
scss/
main.scss
index.html
module2/
...