Gulp plugin to include scripts and styles into your HTML files automatically.
Based on gulp-include-source fork by Xlander11
Install with npm
npm install gulp-include-source-ex --save-dev
const includeSources = require('gulp-include-source-ex');
return gulp.src('./client/index.html').pipe(includeSource({
'cwd': 'src/',
'prefix': 'js',
'context': {
'js_list': ['example/app.js', 'controllers/*.js']
}
})).pipe(gulp.dest('build/'));<html>
<head>
<!-- include:css(style/**/*.css) -->
</head>
<body>
<!-- include:js(file:vendorListFile) -->
<!-- include:js(list:js_list) -->
<!-- include:js(script/**/*.js) -->
</body>
</html>/jquery/dist/jquery.js
/angular/angular.js
<html>
<head>
<link rel="stylesheet" href="style/main.css">
</head>
<body>
<script src="js/jquery/dist/jquery.js"></script>
<script src="js/angular/angular.js"></script>
<script src="js/example/app.js"></script>
<script src="js/controllers/LoginController.js"></script>
<script src="js/controllers/MainController.js"></script>
</body>
</html>Type: String
Base directory from where the plugin will search for source files.
Type: String
When available, will override script extension in resulted HTML code.
Type: String
When available, will override style extension in resulted HTML code.
Type: String
When available, will add before all filenames.
Type: boolean
When available, will skip all empty files
Type: boolean
When available, will add file hash to end filename /script.js?123456.
MIT © vovanre just.vovanre@gmail.com