What are the differences between Grunt, Gulp.js and Bower? Why & when to use them?

In essence and with a lot of hand-waving away of details, Gulp and Grunt are both systems for automating serieses of inter-dependent tasks, commonly used for defining the “build” of your project, like a modern take on the make tool. Typically a project uses one of them or the other, but not both at the … Read more

Using grunt server, how can I redirect all requests to root url?

First, using your command line, navigate to your directory with your gruntfile. Type this in the CLI: npm install –save-dev connect-modrewrite At the top of your grunt file put this: var modRewrite = require(‘connect-modrewrite’); Now the next part, you only want to add modRewrite into your connect: modRewrite([‘!\\.html|\\.js|\\.svg|\\.css|\\.png$ /index.html [L]’]), Here is a example of … Read more

WARNING: Tried to load angular more than once. Angular JS

In my case this was due to the following html code: <!doctype html> <html> <head> <meta charset=”utf-8″> <title>Testapp</title> </head> <body ng-app=”testApp”> <main ui-view> <script src=”https://stackoverflow.com/questions/23499853/bower_components/jquery/jquery.js”></script> <script src=”bower_components/angular/angular.js”></script> <script src=”bower_components/angular-ui-router/release/angular-ui-router.js”></script> <script src=”scripts/main.js”></script> </body> </html> As you can see, the <main> is not closed. This led to my variant of ‘WARNING: Tried to load angular more than … Read more

Grunt debugging from Webstorm

You have to run grunt-cli as a Node application: Create a new Node.js Run/Debug configuration: Run->Edit configurations… In Path to Node choose your node binary, ie: /Users/someuser/nvm/v0.10.5/bin/node In Working Directory, choose your Gruntfile.js directory, ie /Projects/someproject In Path to Node App JS File, choose your Grunt CLI path (you can choose the grunt-cli symlink created … Read more

How can I run a grunt task from within a grunt task?

Here’s an example of manually configuring a task within a task and then running it. https://github.com/gruntjs/grunt-contrib/issues/118#issuecomment-8482130 grunt.registerMultiTask(‘multicss’, ‘Minify CSS files in a folder’, function() { var count = 0; grunt.file.expandFiles(this.data).forEach(function(file) { var property = ‘mincss.css’+count+’.files’; var value = {}; value[file] = file; grunt.config(property, value); grunt.log.writeln(“Minifying CSS “+file); count++; }); grunt.task.run(‘mincss’); });

How to use grunt-contrib-livereload?

Live reloading is now built into grunt-contrib-watch version 0.4.0. grunt-contrib-livereload and grunt-regarde will be deprecated soon. Now just set the option livereload to true in your config and it will create a live reload server then reload after the tasks have run: grunt.initConfig({ watch: { all: { options: { livereload: true }, files: [‘lib/*.js’], tasks: … Read more

How can I rename files with Grunt, based on the respective file’s parent folder name?

This can be done using the grunt-contrib-copy plugin. The main thing to note is that you can change the destination programmatically by using a rename function (which takes in the destination and source of each file). Here is a (somewhat brittle) sample Gruntfile.js that should copy to your desired structure: module.exports = function(grunt) { // … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)