A gulp plugin to extract file assets.
Attention: Version 2.0.0+ is not compatible with 1.0.0+.
First, install gulp-file-assets
as a development dependency:
npm install --save-dev gulp-file-assets
Then, add it to your gulpfile.js
:
var gulp = require('gulp');
var fileAssets = require('gulp-file-assets');
gulp.task('default', function(){
return gulp
.src('index.html')
.pipe(fileAssets())
.pipe(gulp.dest('dist'));
});
Notice: If your source files are in a folder, please set the base
option of gulp.src(options)
to a right path.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>gulp-file-assets</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<a href="sample.html">Link</a>
</body>
</html>
#logo {
background: url(../img/logo.png);
}
var gulp = require('gulp');
var fileAssets = require('gulp-file-assets');
gulp.task('default', function() {
return gulp
.src('index.html')
.pipe(fileAssets({
excludes: ['html']
}))
.pipe(gulp.dest('dist'));
});
// => ['dist/index.html', 'dist/css/style.css', 'dist/img/logo.png']
Type: Object
File extensions to be extracted.
Type: Array
Default:
[
'js', 'css', 'html', 'tpl',
'jpg', 'jpeg', 'png', 'gif', 'svg', 'webp',
'ttf', 'eot', 'otf', 'woff'
]
File extensions to be excluded.
Type: Array
Default: []
Whether to put the source files to the pipeline.
Type: Boolean
Default: true
The depth of files to extract.
Type: Number
Default: null
A file path/RegExp list to be ignored.
Type: Array
Default: []
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарии ( 0 )