FAQ Database Discussion Community


Getting undefined with custom function execution in grunt task

gruntjs
Try to execute below custom task: 'use strict'; module.exports = function(grunt) { grunt.initConfig({ log: { one: [1, 2, 3], two: "Hello World", three: true, four: { five: function() { grunt.log.writeln("Hi"); }, six: function() { grunt.log.writeln("Welcome"); } } } }); grunt.registerMultiTask('log', 'Log stuff', function() { grunt.log.writeln(this.target + ": " + this.data...

Node module to execute tasks grunt : “Gruntfile.js” not find

javascript,node.js,command-line,gruntjs
I'm currently trying to develop a module that will allow node to run Grunt tasks from the command line. This Node module is installed globally : C:\Users\pcharpin\AppData\Roaming\npm\node_modules\task-app The goal is that the use of "Grunt" commands is transparent to the user. To better explain my approach, a simple example of...

Rails minify/optimize files on the fly using Grunt or Gulp

ruby-on-rails,gruntjs,gulp,sidekiq
My Rails 4 application allow it's users to import some Adobe Edge animation files (advertisement). While it works, Adobe Edge is loading a bunch of files that could be minified and optimized (images) using a tool like Grunt or Gulp. I'm using CarrierWave to upload the files and then I...

How to load a task using loadNpmTask in gruntfile if module is in different directory

javascript,gruntjs,gruntfile
Trying to load module: grunt.loadNpmTasks('grunt-express-server'); from an external directory. Get an error: task .... does not exist. Have you loaded it? Directory structure: client/ node_modules gruntfile dev_server/ node_modules/ grunt-express-server So my question is: how do you run a grunt-task using a node-module which is stored in a external directory? ...

Grunt-contrib-copy: variables within the rename function

javascript,gruntjs,grunt-contrib-copy
I have the following copy task in a gruntfile.js copy: { css: { expand: true, cwd: 'min/css', src: 'theme_<%= props.majorversion %>.<%= props.minorversion %>.min.css', dest: 'dest/dir/', rename: function(dest, src) { return dest + src.replace('_<%= props.majorversion %>.<%= props.minorversion %>',''); } } } Currently, the file is copied successfully but once copied, I'd...

Can I use grunt/gulp to pull a specific version of bootstrap css

twitter-bootstrap,gruntjs,gulp
I'm working on a build process that will compile bootstrap css with my overrides. I would like to specify a version of bootstrap in my config and have grunt/gulp go and get the .less files for that version and then compile them. Is there any plugin or process to have...

How to define bourbon and neat in grunt js file / windows 8 user?

gruntjs,bourbon,neat
I'm trying to use this code and I get error for using "loadPath" duplicated. options: { style: "compressed", sourcemap : true, loadPath: require('node-bourbon').includePaths, loadPath: require('node-neat').includePaths }, ...

Grunt not outputting, returning error

node.js,maven,gruntjs,output,stdout
I run a website which uses Grunt to collect all of my assets into a compiled bundle (translating Less into CSS, translating TS into JS, running tests, etc.). I recently moved to a new computer. Although my source files (including package.json, Gruntfile, pom.xml, etc.) are store in the project's Git...

Handlebars does not output anything

javascript,gruntjs,handlebars.js,yeoman,bower
At the start of the file I define Handlebars etc.: <!-- build:js(.) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script> <script src="bower_components/handlebars/handlebars.js"></script> <!-- endbower --> <!-- endbuild --> At the end of the index.html-file I pull in my Handlebars-file: <!-- build:js({app,.tmp}) scripts/main.js --> <script...

Strange npm behavior when installing packages like grunt

node.js,gruntjs,npm,gulp,bower
I run the following command in my bash and I get the related results: [email protected]:~$ sudo npm install -g grunt-cli /usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt [email protected] /usr/local/lib/node_modules/grunt-cli ├── [email protected] ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected]) and [email protected]:~$ grunt /usr/bin/env: node: No such file or directory I also have try to install...

GruntJS and custom task: require a RequireJS module

gruntjs,requirejs,grunt-contrib-requirejs
I am quite new with GruntJS and I wonder if it is possible to have a task that loads some RequireJs modules to process them and write the result within a JS file. I describe my scenario: I have a RequireJs based project with many files. I would like to...

grunt.file write/copy with permissions

gruntjs,grunt-contrib-copy,gruntfile
Is there a way to specify the permissions of a file during a grunt.file.copy(...), except using the 'fs.chmod' after copy has finished? I will have to require the whole 'fs' module otherwise, just for changing the permissions. Will it be a lot of overhead?...

Run parametrized task using grunt.task.run(taskname)

gruntjs
I did stackoverflow search and looked at Grunt API docs but couldn't find a way to run a parametrized task using grunt.task.run(taskname). I have a simple task which accepts a parameter and prints the message on console: grunt.registerTask('hello', 'greeting task', function(name) { if(!name || !name.length) grunt.warn('you need to provide a...

grunt-http-server is stop running

gruntjs
I am trying to use the grunt-http-server https://www.npmjs.com/package/grunt-http-server I follow the example that is on the link 'http-server': { 'dev': { // the server root directory root: apps, // the server port // can also be written as a function, e.g. // port: function() { return 8282; } port: 8282,...

Add locale moment to an AngularJS app

angularjs,gruntjs,momentjs
I'm trying to configure the locale language for an AngularJS app based on Yeoman. When I serve the dist package after building my app (grunt build), the script reference dissapears. Here's a list of my dependencies on the index.html file. <!-- build:js(.) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script...

Yeoman angular grunt-serve vs http-serve

angularjs,gruntjs,npm,yeoman,http-server
I've just used Yeoman to create an Angular project that looks great when I run grunt serve. But then I decided to view it by running http-server, and the page gets displayed without the formatting and without the images. Does anyone know why that is and if I'll run into...

Error 'uiGrid' must have exactly one root element. ui-grid/ui-grid when UI-Grid is initiated

angularjs,gruntjs,ng-grid,angular-ui-grid
While trying to add ui-grid to an angular project, I came across this issue. I’ve bootstrapped the angel;ar application with ui-grid dependency injected. var app = angular.module(‘myApp’,
 ['ui.bootstrap',
 'services',
 'filters',
 'directives',
 'controllers',
 'ui.grid'
 ]); The controller looks like this. angular.module('controllers').controller('UIGridCtrl',function UIGridCtrl($scope) {
 $scope.init = function(){
 $scope.myData = [
 {"firstName": "Cox",...

Message appears when running scsslint

sass,gruntjs
I am following the step by step on https://www.npmjs.com/package/grunt-scss-lint I have installed everything, and seems to be working fine when I type in Terminal 'scss-lint'. However I want this to be running in Grunt Gruntfile: scsslint: { allFiles: [ 'src/scss/**/*.scss', ], options: { bundleExec: true, config: '.scss-lint.yml', reporterOutput: 'scss-lint-report.xml', colorizeOutput:...

How to execute jasmine tests for node modules from grunt

javascript,node.js,gruntjs,jasmine
I want to run some Jasmine 2.x tests for node.js modules in a Grunt build. My setup looks like this: src/foo.js exports.bar = 23; spec/foo.spec.js var foo = require("../src/foo.js"); define("foo", function() { it("exports bar as 23", function() { expect(foo.bar).toBe(23); }); }); With grunt-contrib-jasmine the node module system is not available...

How to make grunt run some tasks at a special point in time?

javascript,node.js,testing,gruntjs,automated-tests
I am using Grunt to run Jasmine tests and Nightwatch.js tests. Is it possible to make Grunt run the tests at a special point in time? For example Grunt could run the tests always when saving changed code. Or Grunt could run the tests always at 1 am in the...

Electron default app doesn't change

gruntjs,electron
I am trying to convert my Google Closure Library used web app to Electron. I've used grunt-electron to package the application but it seems it doesn't change the default app of the Test.app. In Test.app/Contents/Contents/app/ there exist my application, but it doesn't load my app, but indeed loads default app....

Asynchronous tasks in grunt.registerTask

gruntjs,karma-runner
I need to call two functions within grunt.registerTask, but the second function has to be called after the first function is done. So I was wondering if we can use callbacks or promises or other asynchronous mechanisms within grunt.registerTask. (More specifically, I need to launch karma in my first function...

What does slash dot refer to in a file path?

windows,git,gruntjs,filepath,slash
I'm trying to install a grunt template on my computer but I'm having issues. I realized that perhaps something different is happening because of the path given by the Grunt docs, which is %USERPROFILE%\.grunt-init\ What does that . mean before grunt-init? I've tried to do the whole import manually but...

AngularJS minification

angularjs,gruntjs,bundling-and-minification
EDIT 3 : The problem was absolutely not dependencie injection but with angular-mock. See 'Pierre Gayvallet' answer below. I'd like to avoid using ngmin, ngAnnotate or others grunt plugin when i minify my code. So i'm using inline annotation like this : app.controller('myController', ['$scope', function($scope) { // some code }]);...

When starting Nightwatch with Grunt, the website server is not started

javascript,node.js,selenium,gruntjs,nightwatch.js
I am using Nightwatch.js to run system tests for a website. I want to automate the tests by running them via grunt. My Gruntfile contains these lines: ... var nightwatch = require('nightwatch'); nightwatch.initGrunt(grunt); ... nightwatch: { options: { standalone: true, test_settings: { "default": { "launch_url": "http://localhost", "selenium_port": 4444, "selenium_host": "localhost",...

“Arguments to path.resolve must be strings” when calling 'gitbook build' from a Git hook

node.js,git,gruntjs,githooks,gitbook
I am trying to run gitbook build within a post-receive Git hook on my (Gitlab, Debian 7, virtual private) server. Basically I want to: checkout the bare repository to a temporary dir run gitbook build in that temporary dir sync with the webspace through rsync The post-receive script runs something...

Sailsjs with angularjs npm install error

angularjs,gruntjs,npm,sails.js
i am using sails js backend and frontend angularjs. i have given npm install. npm install package show this error: npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer [email protected] wants grunt@~0.4.0 npm ERR! peerinvalid Peer [email protected] wants grunt@>=0.4.0 npm ERR! peerinvalid...

Combine js files from different directories via config using grunt

javascript,gruntjs,npm,minify
I'm using grunt and sass and I'm looking for a sass-like feature to import any JS file I like to and combine them to 1 file via some config depending on the directory I am in. Example directories: startpage file1.js file2.js importjs.json page1 file3.js file4.js importjs.json global global1.js global2.js Each...

grunt-bower-install won't include my css files

javascript,gruntjs,npm,bower
I'm quite new to bower and grunt, so basic things work bad for me. I've bower install --save bootstrap and want grunt-bower-install to update my js & css files, according to documentation It works great with the .js files, and I have successfully updated my index.html <!-- bower:js --> <script...

grunt-contrib-cssmin : Relative path of images is not replaced in target minified file

css,gruntjs,relative-path,grunt-contrib-cssmin
I am using grunt-contrib-cssmin, for the minification of my css files. I want the relative urls in the css files to be replaced automatically in my target minified file. I have looked for this problem and found the two options that I can use to replace the url, target, root...

Grunt tasks stuck in endless loop

javascript,node.js,gruntjs,npm,grunt-contrib-concat
Working on putting together a base Gruntfile.js for some upcoming projects. Starting in on a new computer so everything has been a fresh build. Installed Node and NPM using Homebrew, and then installed Grunt globally, as well as in my local directory. Here is my package.json: { "name": "timespent-prototype", "version":...

Grunt Build Aborted Due to Warnings

angularjs,gruntjs,yeoman,karma-jasmine,yeoman-generator-angular
I'm new to angular and I'm working with Yeoman scaffolded apps and Grunt. I successfully created a few Grunt builds earlier on in the project but now when I do: Grunt build I get the following message: I'm not sure how to interpret the command line output which is below....

How do I reuse a grunt copy task for multiple destinations dynamically?

gruntjs,grunt-contrib-copy
Instead of adding the destinations in the dest attribute I would like to make it dynamic so I can assign the destinations when I run the task from the command line or when I run it from another task. That way I can copy the file to any folder(s) I...

pass middleman variable to grunt file

javascript,gruntjs,html-email,middleman
My middleman template has an 'id' variable that I put my html emails job name into. I know if I change my middleman erb file from index.html.erb to newName.html.erb it will output that as the final files name. My problem is that most of my grunt tasks require the file...

JSLint error: “Expected a newline at EOF”, conflict with Beautify plugin

javascript,gruntjs,jslint,beautify
I have a problem while building the sources using Grunt, with JSLint task for error check: L177: Expected a newline at the end of the file. Warning: Formatting check failed. Use --force to continue. Aborted due to warnings. The problem is obvious, but I use also the Beautify plugin for...

Grunt build is leaving out a new directory in 'Dist'

angularjs,build,gruntjs,yeoman,yeoman-generator-angular
I'm new to angular and I'm trying to do a grunt build of my Yeoman scaffolded app. At one point in my project I created a new sub directory of "app/". When I do a Grunt build this directory is not included in the "dist" project and it's causing errors....

What is the correct option to use Grunt locally and on the production server, --save or --save-dev?

gruntjs
The install page on the Grunt website gives the following suggestion Grunt and Grunt plugins should be defined as devDependencies in your project's package.json. This will allow you to install all of your project's dependencies with a single command: npm install. I want to use grunt to run some tasks...

Why doesn't postinstall run everytime?

jenkins,gruntjs,npm
I have a package.json file that has the following JSON at the bottom. "scripts": { "postinstall": [ "./node_modules/bower/bin/bower install && ./node_modules/protractor/bin/webdriver-manager update" ] } My reason for having this is so bower dependencies and my protractor tests will run after an "npm install". However, it seems that "postinstall" doesn't always...

How to get Bower Install to copy files to another directory before linking them in html file?

gruntjs,bower-install
In my gruntfile.js I am using bower install to create the necessary script tags in my index.html for all my js libraries. My grunt file entry looks like this: bowerInstall: { target: { src: ['wwwroot/index.html'], cwd: '', dependencies: true, devDependencies: true, exclude: [], fileTypes: {}, ignorePath: '', overrides: {} }...

Using grunt for front end with php

php,html,gruntjs
Forgive me, I'm new to Grunt and I don't typically code PHP. This is a new project for me. I'm trying to use Grunt, because it's awesome, with some html files that have minimal php in them. I originally installed the regular grunt, not the php grunt. Now I realize...

Grunt hangs on uglify

node.js,gruntjs,minify,grunt-contrib-uglify
I am trying to minify a little angular script, but for some reason uglify just hangs indefinitely. JSHint runs fine and completes if I add it into the task list, and then it hangs on uglify. Here is my Gruntfile: module.exports = function (grunt) { // Project configuration grunt.initConfig({ //...

How do I access a user input from grunt-prompt in other tasks

javascript,gruntjs,grunt-prompt
I need to write a grunt job for reading a user input using grunt-prompt and then create a directory with that name. I am trying to use the config to access variable in another grunt task which will be executed after the grunt-prompt. But all following methods gives an undefined....

Grunt start Node Server and then open browser

javascript,node.js,gruntjs,connect
I have grunt task that starts the server: module.exports = function(grunt){ grunt.registerMultiTask('connect', 'Run a simple Node Server', function(){ var options = this.options(); // Tell Grunt this task is asynchronous. var done = this.async(); var server = connect(); server.use(function(request, response, nxt){ ... }); server.listen(port); }); }; Now I want to use...

grunt-contrib-copy syntax for process option confusion

gruntjs,grunt-contrib-copy
I'm trying to replace some placeholders in different files as I copy. My gruntfile works fine, but adding in the process option to do the replacements, it's just not working. Below is the relevant section of my gruntfile: grunt.initConfig({ copy: { js: { files: [{ expand: true, cwd: 'src/wp-content/themes/pilau-starter/', src:...

Is grunt.file.write(…) synchronous or asynchronous?

javascript,node.js,asynchronous,gruntjs
I have a code in which i am running a grunt task asynchronously using var done = this.async(); Somewhere in the code I am writing to a file and then calling a callback as follows: grunt.fie.write(<necessary arguments>); callback(null); My question is, will there be a case in which the callback...

message: 'Unexpected token: punc (.)', while using uglify in grunt

javascript,css,gruntjs,grunt-contrib-uglify
Goal My goal is to concatenate all my css,js files and minify all of them. I can minify my concat.js, but I'm struggling trying to minify my concat.css. Gruntfile.js module.exports = function(grunt) { "use strict"; grunt.initConfig({ concat: { js: { src: [ 'js/bootstrap.min.js', 'js/jquery-1.10.2.min.js', 'js/jquery.easypiechart.min.js', 'js/jquery.isotope.min.js', 'js/jquery.magnific-popup.min.js', 'js/waypoints.min.js', 'js/respond.min.js', 'js/jquery.vegas.min.js',...

-bash: grunt: command not found

node.js,osx,bash,gruntjs,npm
I was using node 0.10.35 and grunt command was working fine. Now after upgrading to 0.12.3 grunt command has stopped working. OS: Mac OSX 10.10.1 node: 0.12.3 npm: 2.9.1 grunt: 0.4.5 I thought there may be problem in node installation, so I clean installed it 3-4 times I tried installing...

How do I compile mutliple HTML Jade templates that use the same mixin

html,node.js,gruntjs,jade
mixin hero(title) .hero .hero__inner h1.hero__title #{title} So, my project uses a Jade mixin like the above on multiple pages and, when I compile the Jade to HTML pages, I have to copy that mixin on each page that it is used. I can compile the pages using either grunt-jade or...

Running grunt just opens up a Notepad file instead of actually running the tasks

javascript,gruntjs
I'm trying to create a basic Grunt file to execute some tasks. Trouble is, when I execute grunt from within the directory of the project, a Notepad file opens, displaying the contents of grunt.js rather than actually running. I've also tried naming the file Gruntfile.js but then I get a...

SailsJS: Requiring Assets, Such As, sails.io.js

javascript,node.js,socket.io,gruntjs,sails.js
As the problem is short & sweet, I'll keep the question so. CAN'T LOAD ASSETS. Using Sails.js (v0.11.n). Can't load assets... That's about it... I'm trying to load sails.io.js -- or now even just assets/alert.js. <script type="text/javascript" src="/js/dependencies/sails.io.js"></script> Doesn't work :( Even when I switch the src to /alert.js --...

Visual Studio 2015: Destination wwwroot/css/site.css not written because no source files were found.

gruntjs,visual-studio-2015
I'm trying to use grunt in my ASP project, but for whatever reasons have get a stupid warning-message from Visual Studio. How you can see down, the bower-task has been executed, but haven't uglify- and less-tasks. Gruntfile.js and folder "wwwroot" are in the same folder. What's wrong ? This is...

With Grunt, how can I compile all *.less files, if I have global mixins and constants?

gruntjs,less,grunt-contrib-less
I want to organize my HTML, JS, and LESS by module. I'm already using Grunt to compile *.js and *.html from my source folders. So I configured grunt as follows: grunt.initConfig({ less: { ALL: { files: { 'compiled.css': '**/*.less' } } } } But this runs into a major problem:...

Force grunt-typescript to use node_modules/.bin/tsc

node.js,gruntjs,typescript
How do I force grunt-typescript to use the local typescript instance in my node_modules/.bin folder? My global instance of typescript is 1.4 and I want to try out 1.5Beta without affecting any other project I have.

Grunt grunt-contrib-cssmin runs unending doesn't combine files

node.js,gruntjs,grunt-contrib-cssmin
I am having a strange issue with grunt-contrib-cssmin. It never stops or gives errors. I am using C:\projects\doeclf>grunt --version && node --version && npm --version grunt-cli v0.1.13 grunt v0.4.5 v0.12.4 2.10.1 My grunt.js has following in it cssmin: { target: { files: [{ expand: true, cwd: 'css/', src: ['index.css', '!*.min.css'],...

Loading “Gruntfile.js” tasks…ERROR while running `grunt`

javascript,gruntjs,grunt-contrib-watch,grunt-contrib-concat
I'm new to the Grunt world. After installing grunt-cli, and all the dependencies, here is my : Gruntfile.js /* Grunt installation: ------------------- npm install -g grunt-cli npm install -g grunt-init npm init (creates a `package.json` file) Project Dependencies: --------------------- npm install grunt --save-dev npm install grunt-contrib-concat --save-dev npm install grunt-contrib-watch...

How to use dynamic values in Grunt tasks called from inside a forEach?

foreach,gruntjs,grunt-contrib-copy
We are trying to run grunt tasks using grunt.config.set for dynamically concatinated strings. These grunt.configs are set in a forEach loop and change each time before the task is run. This does unfortunately not work, as grunt only uses the last grunt.config.set and runs it multiple times with that very...

Yeoman - Gruntfile.js generates source map at build but deletes it after any changes

sass,gruntjs,yeoman,yeoman-generator,gruntfile
I installed Yeoman with angular generator, and it created Gruntfile.js. The problem is that after launching the webserver in the terminal with: grunt serve Yeoman generates main.css with in the end the reference of the source map /*# sourceMappingURL=main.css.map */ But after changing any scss the watch routine regenerates it...

jQuery dependency above Angular one: WARNING: Tried to load angular more than once

jquery,angularjs,gruntjs,bower,grunt-wiredep
I am working on a Yeoman Angular-generated folder. I installed through Bower a module that requires jQuery. Grunt's wiredep places the jQuery dependency above the AngularJS in the index.html, as follows: <!-- build:js(.) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-animate/angular-animate.js"></script> ... <!-- endbower --> <!--...

Compiling SASS files using Grunt creates an unnecessary folder

javascript,css,sass,gruntjs
So I have been trying to create my first compiled css files using grunt and sass, and i am having a problem that I cant figure it out. Every time that I run the sass task, an unnecessary "sass" folder is created inside of my css folder: This is how...

Is there a way to specify variable in grunt task name?

gruntjs
Is there a way to specify variable in grunt task name? I would like to do something like grunt build version 0.1 and then in gruntfile.js grunt.initConfig({ version: // read that version files: { '<%= version %>.js' ...

Images doesn't display on AngularJS website after uploading them with filezilla

angularjs,image,website,gruntjs,filezilla
I created an AngularJS project. With doing the grunt serve, grunt serve:dist commands in my terminal, my images are loaded. I upload my page to a webserver with filezilla, but on the public webpage my images are not found. I discovered that the images in my dist folder 2 extensions...

Yeoman angular dist version of app, does not restrict the direct folder access

angularjs,.htaccess,gruntjs,yeoman-generator,yeoman-generator-angular
I am facing this issue for my angular app. Dist version of app, does not restrict the direct folder access. so www.mysite.com/scripts and /images and /styles folder are accessible. This issue is not coming in development i.e. grunt serve this is coming in grunt serve:dist. I have tried the deny...

Grunt tasks running indefinitely

javascript,node.js,gruntjs,grunt-contrib-imagemin
I have installed grunt and trying the grunt-react and grunt-contrib-imagemin tasks. I have setup the following Gruntfile.js. module.exports = function(grunt) { grunt.initConfig ({ imagemin: { dynamic: { files: [{ expand: true, cwd: 'public', src: ['development/images/*.{png,jpg,gif}'], dest: 'images' }], options: { cache: false } } }, react: { single_file_output: { files:...

apt-get install -g grunt grunt-cli missing modules

node.js,gruntjs
I'm using a Ubuntu 14.04 server and am trying to install grunt & grunt-cli with this command: npm install -g grunt grunt-cli Everything looks fine, no errors are recieved. But when I run the standard grunt command, I recieve this error: module.js:338 throw err; ^ Error: Cannot find module 'eventemitter2'...

$http.get returns actual php script instead of running it (yeoman, grunt)

php,angularjs,pdo,gruntjs
I'm building a "simple" AngularJS app with an articles newsfeed. My articles are stored in a mysql database, and I extract them using php PDO. I used to do this using AJAX with a simple LAMP configuration (php5, mysql, apache2), and everything worked as intended. Now I'm trying to rebuild...

How to run multiple application on Grunt

angularjs,gruntjs,server
I have two applications say applicationA and applicationB and if I run following command on terminal grunt serve my one applicationA will up and work fine. when i need to run applicationB, first i need to stop applicationA and then i can run applicationB. If i try to run both...

execute a node command from a grunt task

node.js,gruntjs
I have a grunt task from which I would like to run a node command. The command is not giving any error when I run it, but I was expecting some console output from the task, which I don't seem to be getting at all. What am I missing in...

Yoeman task “autoprefixer:dist” gets stuck

angularjs,gruntjs,autoprefixer
I'm pretty new to grunt workflow. I have installed https://github.com/DaftMonk/generator-angular-fullstack. When i run grunt serve, its gets stuck at autoprefixer:dist task. When I commented out autoprefixer task the rest of the task go through and I get the app running. Not sure whats wrong. Please help me get rid of...

How do I create a deploy git branch for my Yeoman project?

git,deployment,gruntjs,yeoman,branching-and-merging
I created a new project using Yeoman. Using Grunt I've created the dist directory. My whole project is on Github, https://github.com/d3a1i0/mykungfuisstrong.com, and I've created a prod branch. My question is how do I get my prod branch to have only the contents of dist instead of having the dist directory...

grunt-contrib- packages are officially supported by Grunt?

javascript,gruntjs,requirejs,r.js,grunt-contrib-requirejs
I'm about to use the RequireJs plugin for Grunt. I found out that there are two plugins with the same functionality: grunt-contrib-requirejs (https://github.com/gruntjs/grunt-contrib-requirejs) grunt-requirejs (https://github.com/asciidisco/grunt-requirejs) I am wondering if -contrib prefixed plugins are the trusted, maintained and officially supported ones by Grunt? Is this a pattern that developers should look...

Compass file path errors in Grunt

angularjs,gruntjs,yeoman,compass,grunt-contrib-compass
in Gruntfile.js: compass: { options: { sassDir: '<%= yeoman.app %>/styles', cssDir: '.tmp/styles', generatedImagesDir: '.tmp/images/generated', imagesDir: '<%= yeoman.app %>/images', javascriptsDir: '<%= yeoman.app %>/scripts', fontsDir: '<%= yeoman.app %>/styles/fonts', importPath: '<%= yeoman.app %>/bower_components', httpImagesPath: '../images', httpGeneratedImagesPath: '../images/generated', httpFontsPath: '/styles/fonts', spriteLoadPath: '<%= yeoman.app %>/styles/sprites/', relativeAssets: true,...

Is express similar to grunt? what is the difference? what are the advantages of express over grunt?

node.js,express,gruntjs,mean-stack
I've been working on node,grunt,bower and yeoman from couple of months. I came across MEAN stack applications, in which expressjs is providing the server environment(my understanding). Are both grunt and express similar? Requesting for some helpful link on express and MEAN stack. ...

Organize multi-app project with share code

git,github,gruntjs,openui5,sapui
I have a serious problem (!!!) about organizing my develop environment; I have two apps: app1 and app2. This apps are written using OpenUI5 (but this detail is not important) app1 and app2 are similar and share some code (for example the code to login). I use git (with git-flow)...

Grunt SASS Invalid property name appearance

css,sass,gruntjs,autoprefixer
When using the following SASS code .select select -webkit-appearance: none -moz-appearance: none appearance: none I'm getting a "Invalid property name" when compiling via Grunt. The problem seems to be the line with "-moz-appearance: none". I'm using Autoprefixer, but it doesn't support the appearance property (https://github.com/postcss/autoprefixer#why-doesnt-autoprefixer-support-appearance). What's the best way to...

When using Libsass/Grunt is there a way to watch files on the fly?

css,sass,gruntjs,zurb-foundation-5,libsass
I have installed Foundation 5 using >gem install foundation And then creating a new project using the command >foundation scratch --libsass The main reason being is that I'm on Windows and I really don't need/want to be using compass. I know that after I make changes to my sass files...

Grunt filerev, usemin and file caching

angularjs,caching,gruntjs,grunt-usemin
I'm using grunt filerev task to add cachebusters to files when their content changes. usemin task to replace the relevant file path with their revved versions where they are referred. Everything is setup well and they are working as expected / written in their documentation. I'll try to explain the...

Complex gruntjs tasks

gruntjs,grunt-contrib-concat,grunt-contrib-uglify
I have the following scenario: concat some files uglify some files (based on the concatinated ones) concat a files to another file (that was uglified above) How would I write gruntfile.js? I tried something as this but it didn't work. Thanks module.exports = function(grunt) { grunt.initConfig({ pkg:grunt.file.readJSON('package.json'), concat: { target:...

I can not use grunt -cli and grunt serve in my web hosting

node.js,gruntjs,grunt-cli
I have developed a website on Node.js that runs perfectly on my local machine. I run my server with the command: $ grunt serve The problem is when i run my web application on my server online ( gandi server ). I can't use the command $ grunt serve Because...

need to generate css from scss file on windows 8.1 using gruntjs compass

css3,sass,gruntjs,grunt-contrib-watch
I am working on a and facing problem to generate tabs.css file from the tabs.scss that is being provided . I have tried all possible options. I am able to successfully generate tabs.js under dist/ folder but failing to generate tabs.css. I have run the following commands also: npm install...

ENOTUP using Grunt

javascript,node.js,gruntjs,minify,grunt-contrib-concat
I'm using Grunt to minify and concatenate files for an AngularJS web application. Our source is on a file share and I'm connecting to it via a mapped drive. Whenever Grunt runs over my source directory, I get an error on one of my concat tasks. The error is "ENOTSUP,...

How can I minify my index.php using grunt?

php,html,optimization,gruntjs,minify
I want to achieve this using grunt Goal My main goal is to minify my index.php before placing them on my production server. It's simple if I have 1 single index.html, but I don't. Instead I have an index.php full with other .php files. Each <?php ?> section is...

How to setup grunt-babel to transpile an entire directory

gruntjs,babel,transpiler
So I have this in my gruntfile: gruntConfig.babel = { options: { sourceMap: true }, dist: { files: { "dist/server.js": "src/*.js" } } }; This correctly transpiles all the js files in src, but it overwrites dist/server.js every time. This must be really simple, but I can't seem to figure...

Changing JS variable with Grunt for different environments

javascript,build,gruntjs,environment-variables
I'm trying to configure my JS build to do next: I'm using a JS variable to define the application root: globals.js define(function (require) { "use strict"; return { mainRoot: "http://myapp.com" //mainRoot: "http://localhost:3000" - local run //mainRoot: "http://myapp-test.com" - test server }; }); During local development I'm using code without Grunt...

generating templates with grunt - looking for a task

javascript,node.js,templates,gruntjs,task
I've got an HTML file with following content: <html> <body> <span>{{ secret }}</span> </body> </html> I'm looking for a grunt task that could take this source file, take a map of values: grunt.initConfig({ myTask: { myTarget: { src: ... dest: ... values: { secret: 'ABC' } } } }) and...

Error using Grunt watch and SASS

node.js,sass,gruntjs
I am trying to use grunt watch t with SASS on Windows, but everytime I get an error Waiting... OK >> File "scss\main.scss" changed. Running "sass:dist" (sass) task Error: Error generating source map: couldn't determine public URL for the source stylesheet. No filename is available so there's nothing for the...

How to configure Grunt with ASP.NET WebApi Project?

angularjs,asp.net-web-api,gruntjs
I am new to grunt and i want to use this with my current Asp.Net WebApi Single Page Application. For that purpose i want to know how we can configure Grunt with ASP.NET Project.. I am using Visual Studio 2013...

Why are my SVG icons clipped when using grunt svg sprite?

html,css,svg,gruntjs
I am using grunt-svg-sprite module (https://www.npmjs.com/package/grunt-svg-sprite) to create a sprite with the view mode and symbol mode as shown below: svg_sprite: { svg_icons: { expand: true, cwd: 'src/app/assets/artwork/svgs', src: ['**/*.svg'], dest: 'src/app/assets/artwork', options: { shape: { spacing: { // Spacing related options padding: 1, // Padding around all shapes box:...

Is there a way with Grunt to automatically link css files to HTML

html,css,gruntjs
I am just wondering if there is a way to automatically link css files to HTML. For example just give the files (dependencies) path and it will be automatically stylesheet link to the specific HTML file. Thank you...

How to include only specific parts of UI Bootstrap using Grunt

gruntjs,angular-ui-bootstrap,bower
I'm using the accordion, tooltips and transition components of UI Bootstrap. I can create a custom build with the online tool on the UI Bootstrap website, which will create a minified and non-minified JS file containing only the components I selected, without overhead. However, I don't want to use the...

Writing multiple functions in AMD javascript module

javascript,gruntjs,amd
I am quite new to writing javascript code using AMD. I am stuck at figuring out how to write multiple functions in a file: define(function(){ return { and: function(a,b){ return (a&&b); } }; } ); I tried writing another function plus in the following way: define(function(){ return { plus: function(a,b){...

How to output timestamp when node.js server is restarted via grunt-nodemon?

javascript,node.js,gruntjs,nodemon
I have simple hello world nodejs express application and I just added grunt-nodemon that should watch changes on *.js files. Here is the console output I get when I run grunt and then change some .js file: Running "nodemon:dev" (nodemon) task [nodemon] v1.3.7 [nodemon] to restart at any time, enter...

grunt-contrib-jade compiling to single JS with cwd

gruntjs,jade
I am trying to compile multiple jade templates into single JS file using grunt-contrib-jade. Problem I'm facing is that with full path to templates, I get function names with full path. I want to avoid that, so I tried using cwd (without expand). This ended up with the following: >>...

Grunt inject CSS file into