jchook
jchook

Reputation: 7220

Can I live reload styles, templates, and variables with Aglio?

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']);  

Upvotes: 2

Views: 187

Answers (1)

Daniel
Daniel

Reputation: 8772

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?

Upvotes: 1

Related Questions