简体   繁体   English

如何使用gulp-useref配置gulp文件以将html文件连接到js文件?

[英]how to config gulp file with gulp-useref for concatenate html file to js files?

i have project structure according below image 我有下图所示的项目结构 项目结构 :

and i have gulp file for building my projetc , below code is for uglify and minify my scripts : 而且我有用于构建我的projetc的gulp文件,下面的代码用于uglify和最小化我的脚本:

    gulp.task('useref', function(){
            return gulp.src('*.html')
                .pipe(useref())
                .pipe(gulpIf('*.js', uglify()))
                .pipe(gulpIf('*.css', cssnano()))
                .pipe(gulp.dest('dist'))
});

now my question: my project build successfully but no happening for my html file and concatenate it in to my scripts.min file , therefor when my project up h can't see any thing!!!! 现在我的问题是:我的项目构建成功,但是我的html文件没有发生任何事情,并将其连接到我的scripts.min文件中,因此当我的项目启动时看不到任何东西! ] astonished what i do ? ]我惊讶吗?

gulp.task('useref', function(){
        return gulp.src('script/**/*.html')
            .pipe(useref())
            .pipe(gulpIf('*.js', uglify()))
            .pipe(gulpIf('*.css', cssnano()))
            .pipe(gulp.dest('dist'))
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM