On my shared hosting I would like to have access to gulp (gulp watch
) to compile my LESS assets into CSS. To install gulp I must have npm installed as well.
Unfortunately hosting administrator refused to install npm. Is there any other way to get gulp working on my server?
My gulpfile.js
is presented below:
var gulp = require('gulp'),
connect = require('gulp-connect'),
less = require('gulp-less');
gulp.task('webserver', function() {
connect.server({
livereload: true
});
});
gulp.task('less', function() {
gulp.src('assets/less/app.less')
.pipe(less())
.on('error', console.log.bind(console))
.pipe(gulp.dest('css'))
.pipe(connect.reload());
});
gulp.task('fonts', function() {
gulp.src([
'bower_components/bootstrap/fonts/*',
'bower_components/fontawesome/fonts/*'
])
.pipe(gulp.dest('fonts'));
});
gulp.task('watch', function() {
gulp.watch('assets/less/*.less', ['less']);
});
gulp.task('default', ['webserver', 'less', 'fonts', 'watch']);
Probably I would need to do the same with bower. Making long story short - I just developed my small tiny project on my OS X MAMP localhost where I did all the stuff in terminal (bower search etc. gulp watch etc.
)
In terms of my hosting I also have access to the shell via ssh -l login host
.
Thank you for any hints or even a clear answer that it's impossible.
You can not use gulp without node, but gulp is devel tool.
I think you not need gulp on production server. On production server usually you give files processed with gulp, but no gulp directly.
gulp.task('webserver', function() {
connect.server({
livereload: true
});
});
This is a gulp task never needed on production.
gulp.task('less', function() {
gulp.src('assets/less/app.less')
.pipe(less())
.on('error', console.log.bind(console))
.pipe(gulp.dest('css'))
.pipe(connect.reload());
});
// ...
gulp.task('watch', function() {
gulp.watch('assets/less/*.less', ['less']);
});
These are gulp task never needed on production. You should be putting the compiled CSS files onto the server, perhaps only the compiled CSS and not the .less files.
gulp.task('fonts', function() {
gulp.src([
'bower_components/bootstrap/fonts/*',
'bower_components/fontawesome/fonts/*'
])
.pipe(gulp.dest('fonts'));
});
This is a gulp task never needed on production. You can simply put those files on the server in the compiled destination.
In short, just put your compiled files on prod. Gulp is a build tool. Push the build to production, not the source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With