Configure grunt copy task to exclude files/folders

Found the solution: There is no need for these lines: files: [ {src: [‘.conf1’, ‘.conf2’, ‘./config.js’], dest: ‘output/toolkit/’, filter: ‘isFile’}, {src: [‘./css/**/*’, ‘./img/**/*’, ‘./js/**/*’, ‘./release/**/*’, ‘./lib/**/*’, ‘./locale/**/*’], dest: ‘output/toolkit/’}, {expand: true, cwd: ‘./’, src: [‘**’], dest: ‘output/’} ] because {expand: true, cwd: ‘./’, src: [‘**’], dest: ‘output/’} is a new copy step, copying all files … 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

ESLint’s “no-undef” rule is calling my use of Underscore an undefined variable

The official documentation should give you an idea on how to fix this. Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global …*/ comment, or specified in the globals key in the configuration file. The easiest fix would be to add /* global _ */ at … Read more

Angularjs minification using grunt uglify resulting in js error

You have to use the string-injection based syntax that ensure that the minified version points to the good dependancy : function checkInCtrl ($scope, $rootScope, $location, $http){} becomes : [‘$scope’, ‘$rootScope’, ‘$location’, ‘$http’, function checkInCtrl ($scope, $rootScope, $location, $http){}]

How to include scripts automatically in a yeoman/grunt project?

I used grunt-include-source Install it: npm install grunt-include-source –save-dev In Gruntfile: Load it before initConfig: module.exports = function (grunt) { … grunt.loadNpmTasks(‘grunt-include-source’); Configure includeSource itself in initConfig: grunt.initConfig({ …, includeSource: { options: { basePath: ‘app’, baseUrl: “https://stackoverflow.com/”, }, server: { files: { ‘.tmp/index.html’: ‘<%= yeoman.app %>/index.html’ } }, dist: { files: { ‘<%= yeoman.dist %>/index.html’: … Read more

How to deploy node app that uses grunt to heroku

npm has a support for a postinstall step (among many others) that might be just what you’re looking for. The node.js heroku buildpack runs this command when you push to heroku to resolve build dependencies: $ npm install –production https://devcenter.heroku.com/articles/nodejs-support#build-behavior If you take a look at the npm documentation, you can setup a series of … Read more

grunt (minimatch/glob) folder exclusion

In the currently-in-development version 0.4.0a, the grunt.file.expand method now supports exclusions, and does so in an arguably less complex way than the underlying minimatch matching library. This is possible because grunt.file.expand accepts multiple patterns (whereas minimatch only accepts one). From the grunt.file.expand documentation: This method accepts either comma separated wildcard patterns or an array of … Read more

How to concatenate and minify multiple CSS and JavaScript files with Grunt.js (0.3.x)

concat.js is being included in the concat task’s source files public/js/*.js. You could have a task that removes concat.js (if the file exists) before concatenating again, pass an array to explicitly define which files you want to concatenate and their order, or change the structure of your project. If doing the latter, you could put … Read more

tech