@GuySartorelli thanks for the feedback. In the meantime I’ve managed to get this working…
In response to your questions:
- actually a bit of both - the Bootstrap theme I have is already set up and optimised for the quickest load time using gulp, so I’m keen to make use of that feature. A motivator was also to make use of the gulp browser-sync.
- I’ve managed to set gulp up to scan .ss files instead of .html files, was actually pretty simple in the end. It picks up every .ss file in my templates directory, so form field and email styles etc all get scanned for css/js/asset etc usage. I added a dummy .ss page with all the required .js and .css files I have in PageController requirements to ensure they’re added in by gulp. Then .env and PageController are set up to use dev version or live version of theme (which gulp compiles), so I can easily switch between them and check the optimised resources are working correctly too. And best bit is that when I make any change to a .ss file or .scss gulp will automatically refresh the browser. The one bit I’m missing is what command to put in composer.json to tell it what resources to expose in dev mode vs live mode - is there something like “expose-dev” or only “expose”?
For anyone else interested, to get gulp browser-sync working, you need gulp connect-php
To use it with Browser Sync:
var gulp = require('gulp'),
connect = require('gulp-connect-php'),
browserSync = require('browser-sync');
gulp.task('connect-sync', function() {
connect.server({}, function (){
browserSync({
proxy: '127.0.0.1:8000' // eg. 'http://localhost:8888 if using MAMP'
});
});
gulp.watch('**/*.php').on('change', function () {
browserSync.reload();
});
});