I have a problem including PHP code in my Polymer project. I have tried to set up a ".htaccess" file on my server, but it did not work. Moreover I do not think there is a easy way to change the "index.html" file to a "index.php" file because it is refered to this file in many other files, I do not know. I am using a gulp server on my local computer and I have tried to include a PHP support there but it failed. This is the code of the gulpfile (only minimal modification form the original file):
var gulp = require('gulp');
var connect = require('gulp-connect-php');
...
// Watch Files For Changes & Reload
gulp.task('serve', ['elements', 'images'], function () {
connect.server({}, function (){
browserSync({
notify: false,
snippetOptions: {
rule: {
match: '<span id="browser-sync-binding"></span>',
fn: function (snippet) {
return snippet;
}
}
},
// Run as an https by uncommenting 'https: true'
// Note: this uses an unsigned certificate which on first access
// will present a certificate warning in the browser.
// https: true,
server: {
baseDir: ['.tmp', 'app'],
routes: {
'/bower_components': 'bower_components'
}
}
});
});
gulp.watch(['app/**/*.html'], reload);
gulp.watch(['app/styles/**/*.css'], ['styles', reload]);
gulp.watch(['app/elements/**/*.css'], ['elements', reload]);
gulp.watch(['app/{scripts,elements}/**/*.js'], ['jshint']);
gulp.watch(['app/images/**/*'], reload);
});
...