在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):fmal/gulp-inline-source开源软件地址(OpenSource Url):https://github.com/fmal/gulp-inline-source开源编程语言(OpenSource Language):JavaScript 75.3%开源软件介绍(OpenSource Introduction):gulp-inline-source
How it works<!-- located at src/html/index.html -->
<html>
<head>
<!-- inline src/js/inlineScript.js -->
<script src="../js/inlineScript.js" inline></script>
</head>
<body>
</body>
</html> // located at src/js/inlineScript.js
function test() {
var foo = 'lorem ipsum';
return foo;
} Output: <html>
<head>
<script>function test(){var a="lorem ipsum";return a}</script>
</head>
<body>
</body>
</html> Install$ npm install gulp-inline-source --save-dev Usagevar gulp = require('gulp');
var inlinesource = require('gulp-inline-source');
gulp.task('inlinesource', function () {
return gulp.src('./src/*.html')
.pipe(inlinesource())
.pipe(gulp.dest('./out'));
}); Optionally, you can provide some options through an options object: var gulp = require('gulp');
var inlinesource = require('gulp-inline-source');
gulp.task('inlinesource', function () {
var options = {
compress: false
};
return gulp.src('./src/*.html')
.pipe(inlinesource(options))
.pipe(gulp.dest('./out'));
}); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论