Answer the question
In order to leave comments, you need to log in
Gulp not working, throwing an error? assert.js:351 throw err;?
// Include Gulp and all required libraries
var gulp = require('gulp'),
gutil = require('gulp-util' ),
sass = require('gulp-sass'),
browserSync = require('browser-sync') ,
cleanCSS = require('gulp-clean-css'),
autoprefixer = require('gulp-autoprefixer'),
bourbon = require('node-bourbon'),
ftp = require('vinyl-ftp');
// Update website pages on local server
gulp.task('browser-sync', function() {
browserSync({
proxy: "opencart.loc",
notify: false
});
});
// Compile stylesheet.
return gulp.src('catalog/view/theme/apple/stylesheet/stylesheet.sass')
.pipe(sass({
includePaths: bourbon.includePaths
}).on('error', sass.logError))
.pipe(autoprefixer (['last 15 versions']))
.pipe(cleanCSS())
.pipe(gulp.dest('catalog/view/theme/apple/stylesheet/'))
.pipe(browserSync.reload({stream: true} ))
});
// Watching files
gulp.task('watch', ['sass', 'browser-sync'], function() {
gulp.watch('catalog/view/theme/apple/stylesheet/stylesheet.sass', [ 'sass']);
gulp.watch('catalog/view/theme/apple/template/**/*.tpl', browserSync.reload);
gulp.watch('catalog/view/theme/apple/js/* */*.
gulp.watch('catalog/view/theme/apple/libs/**/*', browserSync.reload);
});
// Upload changes to hosting
gulp.task('deploy', function() {
var conn = ftp.create({
host: 'hostname.com',
user: 'username',
password: 'userpassword',
parallel: 10,
log: gutil.log
});
var globs = [
'catalog/view/theme/apple/**'
];
return gulp.src(globs, {buffer: false})
.pipe(conn.dest('/path/ to/folder/on/server'));
});
gulp.task('default', ['watch']);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question