2

I am unable to live-reload LESS and Jade files using Aglio's --server option or gulp paired with connect's livereload option and the gulp-aglio plugin.

Is this due to caching? Or a limitation of connect's live reload capability?

The only way to make my changes render is to ctrl-C and run gulp again.

Here is my gulpfile.js:

var 
    gulp = require('gulp'),  
    aglio = require('gulp-aglio'),
    connect = require('gulp-connect'),
    plumber = require('gulp-plumber'),
    watch = require('gulp-watch')
;

gulp.task('docs', function(){  
    gulp
        .src('docs/index.apib')
        .pipe(plumber())
        .pipe(aglio({
            themeTemplate: 'docs/templates/triple.jade', 
            themeStyle: 'docs/styles/layout-default.less', 
            themeVariables: 'docs/styles/variables-default.less', 
            themeFullWidth: true
        }))
        .pipe(gulp.dest('docs'))
    ;
});

gulp.task('server', function(){  
    connect.server({
        livereload: true,
        root: ['docs']
    });
});

gulp.task('livereload', ['docs'], function(){  
    gulp
        .src(['docs/*.apib'])
        .pipe(plumber())
        .pipe(connect.reload())
    ;
});

gulp.task('watch', function() {  
    gulp.watch(['docs/*.apib', 'docs/*.md', 'docs/styles/*.less', 'docs/templates/*.jade'], ['docs', 'livereload']);
})

gulp.task('default', ['docs', 'server', 'livereload', 'watch']);
gulp.task('build', ['docs']);  
jchook
  • 6,690
  • 5
  • 38
  • 40

1 Answers1

0

This is currently not possible. The livereload functionality is for reloading the input API Blueprint file only. All of the theme files are cached so that they only get loaded once.

Question: what's your use case for this feature?

Daniel
  • 8,212
  • 2
  • 43
  • 36
  • 1
    Thank you for the response. Got the "tumbleweed badge" for this question lol. Answer: I want to quickly develop a custom template for Aglio. – jchook Nov 01 '16 at 13:48
  • That's useful to know. For now the livereload is geared toward API writers and not toward theme writers, so you'll have to restart Aglio each time you want to see any updates you've made. Honestly I have the same issue when I work on the themes/styles/layouts/etc but it wasn't enough of a pain to warrant livereloading them. – Daniel Nov 01 '16 at 17:17