Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No script injection when the url contains a querystring to a config file #1092

Closed
2 tasks done
declanmagee opened this issue May 9, 2016 · 5 comments
Closed
2 tasks done

Comments

@declanmagee
Copy link

declanmagee commented May 9, 2016

Issue details

I need to pass json data to a page via a query string like below.

http://localhost:3002/index.html?someConfig=SOMECONFIG.json (doesn't work)
http://localhost:3002/index.html?someConfig=SOMECONFIG (works)

Unfortunately , this breaks browser sync due to the file extension in the query string. Can this be fixed?

Steps to reproduce/test case

Test browserSync on any page and add a querystring to a config file with a file extension.
e.g.http://localhost:3002/index.html?someConfig=SOMECONFIG.json

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [ ^2.12.5 ]
  • Node [ 4.4.3 ]
  • Npm [ 2.15.1 ]

Affected platforms

  • windows

Browsersync use-case

  • Gulp

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

var gulp        = require('gulp');
var browserSync = require('browser-sync').create();
var sass        = require('gulp-sass');

var src = {
    scss: 'widgets/shared/polymer/templates/**/*.scss',
    css:  'widgets/shared/polymer/templates',
    html: 'build/**/*.html'
};

// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {

    browserSync.init({
        server: "."
    });

    gulp.watch(src.scss, ['sass']);
    gulp.watch(src.html).on('change', browserSync.reload);
});

// Compile sass into CSS
gulp.task('sass', function() {
    return gulp.src(src.scss)
        .pipe(sass())
        .pipe(gulp.dest(src.css))
        .pipe(browserSync.reload({stream: true}));
});

gulp.task('default', ['serve']);
@shakyShane
Copy link
Contributor

as it's in the query, it shouldn't affect the script injection, sounds like a bug to me. I will look into it

@shakyShane
Copy link
Contributor

thanks for reporting :)

@shakyShane
Copy link
Contributor

Published at browser-sync@2.12.6

@declanmagee
Copy link
Author

Great stuff,

Thanks for the quick turn around - works perfectly now :-)

Declan

On Tue, May 10, 2016 at 6:57 AM, Shane Osbourne notifications@github.com
wrote:

Published at browser-sync@2.12.6


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1092 (comment)

Declan Magee
Front End Web Developer
Dublin | Warrenpoint
Ireland
@declanmagee http://twitter.com/declanmagee

@pleek91
Copy link

pleek91 commented May 26, 2020

Curios, would this also effect files with a hash (#) at the end? For example an svg symbol like like myfile.svg#mysvg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants