Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since I've not looked into the code which generates the sub themes, and I'm just now checking out Omega. I figure this info will help out anyone using the npm(node) gulp task runner. This applies to the new slim bleeding edge sub themes.
You can get livereload going by installing it within the theme folder. Although these modules should be added to package.json.
npm install livereload
npm install gulp-livereload
It may be better to install livereload globally with --global
npm install -g livereload
You can then minimally add a few lines to the current gulpfile.js
var livereload = require('gulp-livereload');
and
.pipe(livereload())
and
livereload.listen();
It will probably look something like this.
'use strict'; var gulp = require('gulp'); var sass = require('gulp-sass'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('gulp-autoprefixer'); var livereload = require('gulp-livereload'); gulp.task('sass:prod', function () { gulp.src('./sass/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(autoprefixer({ browsers: ['last 2 version'] })) .pipe(gulp.dest('./css')); }); gulp.task('sass:dev', function () { gulp.src('./sass/*.scss') .pipe(sourcemaps.init()) .pipe(sass().on('error', sass.logError)) .pipe(autoprefixer({ browsers: ['last 2 version'] })) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('./css')) .pipe(livereload()); }); gulp.task('sass:watch', function () { livereload.listen(); gulp.watch('./sass/**/*.scss', ['sass:dev']); }); gulp.task('default', ['sass:dev', 'sass:watch']);
P.S. Note I didn't add it on 'sass:prod'
Comments
Comment #2
pietpomp CreditAttribution: pietpomp commentedJust to clarify please,
gulp.watch
is for monitoring sass changes while developing, yes.livereload.listen()
... is going to do what? Will this reload the browser after a recompile?Just trying to get a better understanding and switching from grunt.
Cheers
Comment #3
steinmb CreditAttribution: steinmb as a volunteer commentedI think this should be added to the documentation somewhere inside https://www.drupal.org/node/1768686.