Saturday 15 February 2014

gruntjs - is it possible run two instances of yeoman in windows? -



gruntjs - is it possible run two instances of yeoman in windows? -

hi im developing yeoman framework. working on 2 different projects. platform windows 7.

i have changed default "connect" port of 1 of projects 9000 9002.

when running "serve" task of both projects simultaneously, empty screen in sec project browser. possible run both projects simultaneously?

thanks guys

here grunt config:

module.exports = function (grunt) { // load grunt tasks automatically require('load-grunt-tasks')(grunt); // time how long tasks take. can help when optimizing build times require('time-grunt')(grunt); // configurable paths application var appconfig = { app: require('./bower.json').apppath || 'app', dist: 'dist' }; // define configuration tasks grunt.initconfig({ // project settings yeoman: appconfig, // watches files changes , runs tasks based on changed files watch: { bower: { files: ['bower.json'], tasks: ['wiredep'] }, js: { files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], tasks: ['newer:jshint:all'], options: { livereload: '<%= connect.options.livereload %>' } }, jstest: { files: ['test/spec/{,*/}*.js'], tasks: ['newer:jshint:test', 'karma'] }, styles: { files: ['<%= yeoman.app %>/styles/{,*/}*.css'], tasks: ['newer:copy:styles', 'autoprefixer'] }, gruntfile: { files: ['gruntfile.js'] }, livereload: { options: { livereload: '<%= connect.options.livereload %>' }, files: [ '<%= yeoman.app %>/{,*/}*.html', '.tmp/styles/{,*/}*.css', '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' ] } }, // actual grunt server settings connect: { options: { port: 9000, // alter '0.0.0.0' access server outside. hostname: 'localhost', livereload: 35729 }, livereload: { options: { open: true, middleware: function (connect) { homecoming [ connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appconfig.app) ]; } } }, test: { options: { port: 9002, middleware: function (connect) { homecoming [ connect.static('.tmp'), connect.static('test'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appconfig.app) ]; } } }, dist: { options: { open: true, base: '<%= yeoman.dist %>' } } }, // create sure code styles par , there no obvious mistakes jshint: { options: { jshintrc: '.jshintrc', reporter: require('jshint-stylish') }, all: { src: [ 'gruntfile.js', '<%= yeoman.app %>/scripts/{,*/}*.js' ] }, test: { options: { jshintrc: 'test/.jshintrc' }, src: ['test/spec/{,*/}*.js'] } }, // empties folders start fresh clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= yeoman.dist %>/{,*/}*', '!<%= yeoman.dist %>/.git*' ] }] }, server: '.tmp' }, // add together vendor prefixed styles autoprefixer: { options: { browsers: ['last 1 version'] }, dist: { files: [{ expand: true, cwd: '.tmp/styles/', src: '{,*/}*.css', dest: '.tmp/styles/' }] } }, // automatically inject bower components app wiredep: { options: { cwd: '<%= yeoman.app %>' }, app: { src: ['<%= yeoman.app %>/index.html'], ignorepath: /\.\.\// } }, // renames files browser caching purposes filerev: { dist: { src: [ '<%= yeoman.dist %>/scripts/{,*/}*.js', '<%= yeoman.dist %>/styles/{,*/}*.css', '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', '<%= yeoman.dist %>/styles/fonts/*' ] } }, // reads html usemin blocks enable smart builds automatically // concat, minify , revision files. creates configurations in memory // additional tasks can operate on them useminprepare: { html: '<%= yeoman.app %>/index.html', options: { dest: '<%= yeoman.dist %>', flow: { html: { steps: { js: ['concat', 'uglifyjs'], css: ['cssmin'] }, post: {} } } } }, // performs rewrites based on filerev , useminprepare configuration usemin: { html: ['<%= yeoman.dist %>/{,*/}*.html'], css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], options: { assetsdirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images'] } }, // next *-min tasks produce minified files in dist folder // default, `index.html`'s <!-- usemin block --> take care of // minification. these next options pre-configured if not wish // utilize usemin blocks. // cssmin: { // dist: { // files: { // '<%= yeoman.dist %>/styles/main.css': [ // '.tmp/styles/{,*/}*.css' // ] // } // } // }, // uglify: { // dist: { // files: { // '<%= yeoman.dist %>/scripts/scripts.js': [ // '<%= yeoman.dist %>/scripts/scripts.js' // ] // } // } // }, // concat: { // dist: {} // }, imagemin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.{png,jpg,jpeg,gif}', dest: '<%= yeoman.dist %>/images' }] } }, svgmin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.app %>/images', src: '{,*/}*.svg', dest: '<%= yeoman.dist %>/images' }] } }, htmlmin: { dist: { options: { collapsewhitespace: true, conservativecollapse: true, collapsebooleanattributes: true, removecommentsfromcdata: true, removeoptionaltags: true }, files: [{ expand: true, cwd: '<%= yeoman.dist %>', src: ['*.html', 'views/{,*/}*.html'], dest: '<%= yeoman.dist %>' }] } }, // ngmin tries create code safe minification automatically // using angular long form dependency injection. doesn't work on // things resolve or inject have done manually. ngmin: { dist: { files: [{ expand: true, cwd: '.tmp/concat/scripts', src: '*.js', dest: '.tmp/concat/scripts' }] } }, // replace google cdn references cdnify: { dist: { html: ['<%= yeoman.dist %>/*.html'] } }, // copies remaining files places other tasks can utilize copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: [ '*.{ico,png,txt}', '.htaccess', '*.html', 'views/{,*/}*.html', 'images/{,*/}*.{webp}', 'fonts/*' ] }, { expand: true, cwd: '.tmp/images', dest: '<%= yeoman.dist %>/images', src: ['generated/*'] }, { expand: true, cwd: 'bower_components/bootstrap/dist', src: 'fonts/*', dest: '<%= yeoman.dist %>' }] }, styles: { expand: true, cwd: '<%= yeoman.app %>/styles', dest: '.tmp/styles/', src: '{,*/}*.css' } }, // run tasks in parallel speed build process concurrent: { server: [ 'copy:styles' ], test: [ 'copy:styles' ], dist: [ 'copy:styles', 'imagemin', 'svgmin' ] }, // test settings karma: { unit: { configfile: 'test/karma.conf.js', singlerun: true } } }); grunt.registertask('serve', 'compile start connect web server', function (target) { if (target === 'dist') { homecoming grunt.task.run(['build', 'connect:dist:keepalive']); } grunt.task.run([ 'clean:server', 'wiredep', 'concurrent:server', 'autoprefixer', 'connect:livereload', 'watch' ]); }); grunt.registertask('server', 'deprecated task. utilize "serve" task instead', function (target) { grunt.log.warn('the `server` task has been deprecated. utilize `grunt serve` start server.'); grunt.task.run(['serve:' + target]); }); grunt.registertask('test', [ 'clean:server', 'concurrent:test', 'autoprefixer', 'connect:test', 'karma' ]); grunt.registertask('build', [ 'clean:dist', 'wiredep', 'useminprepare', 'concurrent:dist', 'autoprefixer', 'concat', 'ngmin', 'copy:dist', 'cdnify', 'cssmin', 'uglify', 'filerev', 'usemin', 'htmlmin' ]); grunt.registertask('default', [ 'newer:jshint', 'test', 'build' ]); };

gruntjs yeoman

No comments:

Post a Comment