Hello, nice to see a good base theme with Bourbon.
But I have a request, the reload after save is unnecesary, you can avoid it with something like this:
var browserSync = require('browser-sync');
// AND
gulp.task('browser-sync', function() {
browserSync.init({
files: "css/**/*.css",
proxy: 'localhost/mysite',
notify: false
});
});
// AND
gulp.task('default', ['watch', 'browser-sync']);
I don't know but the loadConfig doesn't work for me, I think is more ease declare the options inside the Gulpfile.js
And remember install the module Link CSS
With this you see the changes without reload and instantly.
Comments
Comment #2
kevinquillen commentedWhy is LinkCSS required? In Drupal 8 it looks like CSS is included via link tag if you enable aggregation. Reason I ask is, it's clunky to have a theme require a module, because I can't force that dependency.
What would be great is if you could work with basic Drupal caching enabled, so that the local site is speedy. When everything is off, reloading on save can get progressively slower.
Perhaps it is the VM/config I am using, but practically nothing is forcing a browser reload except when I do browserSync.stream(); within the sass task, which is overkill.
Comment #3
kevinquillen commentedOk, I see now. Here is what I came up with, that only does a browserSync.reload when a twig template changes. I had to add run-sequence to it so it would execute the tasks synchronously. In Gulp 4 this would be changed to series.
Adding LinkCSS (bleh) makes this work. Enabling aggregation still does not work (no reload happens). Would be great to have it so you can work with that enabled. Still, this is a start.
Browser will reload on css/js changes (without specifying browserSync.reload), and be called directly when twig templates change (because internal cache needs to clear first, before browser will see the change).
Comment #4
RAFA3L commentedI thinks yes, just now I update to Drupal 8.0.5 and without the module Link CSS all the styles files are imported using "@import", enabling te module use "link" and no reload. This is with D7 and D8
Comment #5
kevinquillen commentedWhat is kind of murky in Drupal 8 (or at least using Drush) is that calling drush cc css-js says it clears the css/js cache, but reloading the page does not show the changes with aggregation on. With aggregation on, only drush cr seems to make the changes appear on reload, which is far too heavy to expect when you're writing sass and saving every few lines. Even though pages are set to not cache for anonymous users, it seems that they are.
Comment #6
kevinquillen commentedAs far as the options go, the reason they are overridable with a local file is for teams working on a theme who may be working in different environments. Some may want to flush caches some may not, some may have different drush aliases than others, some may not want drush to do anything. 'config.js' should be git ignored, so it doesn't make its way back to the repo.
I am able to copy example.config.js to config.js and make changes, restart gulp and gulp uses those settings. What part of it is not working for you?
Comment #7
RAFA3L commentedI never heard about use aggregation css/js in any other development theme workflow, I never use aggregation in development stage.
At the moment I tried Neato the first time Browsersync doesn't work the options in the "config.js" file, I must have declare the same inside "Gulpfile.js" to make it to work.
Right now I run this and work
Comment #8
kevinquillen commentedMaybe it is just me, I keep all caching on while working so I am not caught by surprise later on when I enable it.
Comment #9
RAFA3L commentedWhat I love of Bourbon/Neat/Bitter is that the ease, clear and speed to develop a theme. I personally prefer develop in real time and debug later, and now that you mention the cache surprise I can remember any issue about that, at least for SASS development. And note that your style file is already 'compressed', I prefer it 'expanded' in development because some time I like to see if the CSS is well formed.
Maybe some another options must be included in the 'config.js' file, the outputStyle and the notify message of SASS, and the Browsersync message in the browser.
Comment #10
kevinquillen commentedYeah, that would be just the reason for that, so while defaults are provided in example.config.js, others can copy and tailor it to their needs without the repo dictating settings and overwriting them on each update.
Comment #11
kevinquillen commentedChanges are still pending to address browser-sync saving and injecting changes to listening browsers for 8.x.
Comment #12
kevinquillen commentedLet's continue the discussion here: #2710181: Update BrowserSync configuration to inject changes to the browser
Comment #13
kevinquillen commented