Dragod83
Dragod83

Reputation: 2327

Running browserSync proxy (grunt) with Visual Studio code using IIS Express extension

What I am trying to achieve is running browserSync with grunt while using Visual studio code editor with the IIS Express Extension installed.

I can ran both IIS (Viusal Studio code extension) and browserSync using proxy:

Gruntfile.js

module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    sass: {

      dist: {
        options: {
          outputStyle: 'expanded',
          sourceMap: true,
          sourceMapEmbed: true
        },
        files: {
          'scss/global.css': 'scss/mccann-global.scss',
          'scss/_imports/theme/dark-theme.css': 'scss/_imports/theme/dark-theme.scss',
          'scss/_imports/theme/light-theme.css': 'scss/_imports/theme/light-theme.scss',
        }
      }
    },

    watch: {
      grunt: {
        options: {
          reload: true
        },
        files: ['Gruntfile.js']
      },

      sass: {
        files: 'scss/**/*.scss',
        tasks: ['sass']
      }
    },
            browserSync: {
            dev: {
                bsFiles: {
                    src: [
                        'scss/*.css',
                        'index.aspx'
                    ]
                },
                options: 
                {
                    proxy: 'localhost:49798', //our IIS server
                    port: 3000, // our new port
                    open: true,
                    watchTask: true
                }
            }
        }
  });

  grunt.loadNpmTasks('grunt-browser-sync');
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-grunticon');
  grunt.loadNpmTasks('grunt-exec');
  grunt.registerTask('build', ['sass']);
  grunt.registerTask('default', ['build','browserSync','watch']);
  
}

Grunt looks good:

enter image description here

Then:

Installed the google chrome COORS plugin and the server run just fine trough the login page... but once I hit the homepage I got two errors: 401 Unauthorized.

enter image description hereenter image description here

I was looking into this:Request format is unrecognized for URL unexpectedly ending in but didn't work for me.

Upvotes: 1

Views: 476

Answers (0)

Related Questions