2

我无法使用 Aglio 的--server选项或与的选项和插件gulp配对来实时重新加载 LESS 和 Jade 文件。connectlivereloadgulp-aglio

这是由于缓存吗?或者是connect实时重装能力的限制?

使我的更改呈现的唯一方法是按 ctrl-C 并再次运行 gulp。

这是我的 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']);  
4

1 回答 1

0

目前这是不可能的。livereload 功能仅用于重新加载输入 API 蓝图文件。所有主题文件都被缓存,因此它们只加载一次。

问题:您对此功能的用例是什么?

于 2016-10-31T18:27:29.583 回答