browsersync gulp proxing doesnt work well with wordpress get_template_path -
i have strange problem. use browser sync , gulp wp-project , strange thing appears. use gulp serve task:
gulp.task('serve', ['styles'], function() { browsersync.init(null, { proxy : localhost:8888/mywpsite, debuginfo: true, open: true }); });
and gulp replace in wiredep task theme make wp like:
gulp.task('wiredep', function() { var wiredep = require('wiredep').stream; gulp.src('**/*.php') .pipe(wiredep({ directory: 'bower_components' })) .pipe(replace(/(<script src=")(bower_components\/)/g, '$1<?php echo get_template_directory_uri(); ?>/$2')) .pipe(gulp.dest('')); });
this result in html markup on footer.php file this:
<!-- build:js scripts/vendor.js --> <!-- bower:js --> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/modernizr/modernizr.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/jquery/dist/jquery.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/fastclick/lib/fastclick.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/jquery.cookie/jquery.cookie.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/jquery-placeholder/jquery.placeholder.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/foundation/js/foundation.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/snap.svg/dist/snap.svg-min.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/fullpage.js/jquery.fullpage.js"></script> <script src="<?php echo get_template_directory_uri(); ?>/bower_components/waypoints/lib/jquery.waypoints.js"></script> <!-- endbower --> <!-- endbuild -->
when run gulp serve see output html file this:
<!-- build:js scripts/vendor.js --> <!-- bower:js --> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/modernizr/modernizr.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/jquery/dist/jquery.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/fastclick/lib/fastclick.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/jquery.cookie/jquery.cookie.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/jquery-placeholder/jquery.placeholder.js"></script> <script src="http://localhost:8888/mywpsite/wp-content/themes/konstrukt/bower_components/foundation/js/foundation.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/snap.svg/dist/snap.svg-min.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/fullpage.js/jquery.fullpage.js"></script> <script src="//localhost:3000/mywpsite/wp-content/themes/konstrukt/bower_components/waypoints/lib/jquery.waypoints.js"></script> <!-- endbower --> <!-- endbuild -->
any ideas why foundation has been lodaed via http://localhost:8888 ? i've tried gulp clear cache no luck that. i've tried change order of bower_components , appears 6th component has different path others.
this browser-sync issue, , has been resolved version 2.8.0. i've updated , works fine!
Comments
Post a Comment