Hello,
I want to add folder with html files which next I want to use with AJAX calls. The only thing I can do is adding these files directly to the project's folder (next to the index.html). I'm guessing I need to do sth with browserSync but I don't know how.
You can see in gulp task watch I've tried to add folder ajax with html files but I can't use them next with ajax call.
My gulpfile.js is:
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var pug = require('gulp-pug');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
var messages = {
jekyllBuild: 'Running: $ jekyll build'
};
/**
Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
});
/**
Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
/**
Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', ['sass', 'jekyll-build'], function() {
browserSync({
server: {
baseDir: '_site'
},
notify: false
});
});
/**
Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
*/
gulp.task('sass', function () {
return gulp.src('assets/css/main.scss')
.pipe(sass({
includePaths: ['css'],
onError: browserSync.notify
}))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('_site/assets/css'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('assets/css'));
});
Hello, I want to add folder with html files which next I want to use with AJAX calls. The only thing I can do is adding these files directly to the project's folder (next to the index.html). I'm guessing I need to do sth with browserSync but I don't know how.
You can see in gulp task watch I've tried to add folder ajax with html files but I can't use them next with ajax call.
My gulpfile.js is:
var gulp = require('gulp'); var browserSync = require('browser-sync'); var sass = require('gulp-sass'); var prefix = require('gulp-autoprefixer'); var cp = require('child_process'); var pug = require('gulp-pug');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll'; var messages = { jekyllBuild: 'Running: $ jekyll build' };
/**
/**
/**
/**
/ I'm trying to Gulp stuff /
gulp.task('pug', function(){ return gulp.src('_pugfiles/*.pug') .pipe(pug()) .pipe(gulp.dest('_includes')); });
/**
/**
gulp
will compile the sass,