Exporting a class with ES6 (Babel)

Browserify is meant to be fed a single “entry point” file, through which it recursively traverses all of your require statements, importing the code from other modules. So you should be require‘ing the _babel.js versions of modules, not _browserified.js ones. From the looks of it, you intend for your app’s “entry point” to be demos/helicopter_game/PlayState_browserified.js, … Read more

Warning: connect.static is not a function Use –force to continue

You have to install connect and serve-static: npm install –save-dev grunt-contrib-connect serve-static And then you have to import serve-static in Gruntfile.js: module.exports = function (grunt) { … var serveStatic = require(‘serve-static’); grunt.initConfig({ … connect: { … livereload: { options: { middleware: function(connect) { return [ serveStatic(‘.tmp’), connect().use(‘/bower_components’, serveStatic(‘./bower_components’)), serveStatic(config.app) ]; } } }

NodeJS environment variables in Grunt

use the grunt-env plugin: https://npmjs.org/package/grunt-env and set your config: grunt.initConfig({ env : { options : { //Shared Options Hash }, dev : { NODE_ENV : ‘development’, DEST : ‘temp’ } }, ‘another-task’: {} }); in your gruntfile you will probably define some default-task: grunt.registerTask(‘default’, [‘env’, ‘another-task’]); so if you run ‘grunt default’ at first your … Read more

grunt-contrib-copy – ignore folder when copying

Try following Gruntfile.js. It ignores psd directory. Solution found in following question. module.exports = function(grunt) { // Project configuration. grunt.initConfig({ copy: { main: { src: [‘**/*’, ‘!**/psd/**’], expand: true, cwd: ‘dev’, dest: ‘pub’, } } }); // Load the plugin that provides the “copy” task. grunt.loadNpmTasks(‘grunt-contrib-copy’); // Default task(s). grunt.registerTask(‘default’, [‘copy’]); }; example setup. mkdir … Read more

How do I fix my generator-angular project so that grunt test works?

I seem to have fixed my problem, for anyone with a similar problem: Within my karma.conf.js I added the following: plugins: [ ‘karma-chrome-launcher’, ‘karma-jasmine’ ], At first I added ‘karma-jasmine’ but was then met with “Can not load “Chrome”, it is not registered!” This was solved by adding ‘karma-chrome-launcher’ as a plug-in Not sure if … Read more

Dynamically add version number to dest output files w/ grunt

I implemented: https://github.com/erickrdch/grunt-string-replace In my source css/js files, I use the text {{ VERSION }} which gets replaced with the version number set in the package.json file. Below is the config I added to Gruntfile.js. ‘string-replace’: { version: { files: { // the files I did string replacement on }, options: { replacements: [{ pattern: … Read more

How can I automate both E2E and unit tests with Yeoman & AngularJS?

As I mentioned in a comment to your question – PhantomJS saves a lot of hassle. That aside, I believe you can handle everything from within your Gruntfile and just continue to run grunt test to start the whole thing. grunt-karma allows full customization of your karma options with some handy add-ons. From the docs: … Read more

Is it possible to use ES6 in a Chrome Extension?

Update This answer was originally written in 2015. The compatibility table link shows Chrome, FF, Edge, and Safari are more compatible than Babel now. Chrome 49+, FF 45+ may not benefit from Babel. Other browsers, may need transpiling. Original I am also currently developing a Chrome Extension in ES6. Your questions seems to be more … Read more

tech