• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

gulp-file-assets: 一个提取文件引用资源的 gulp 插件。

原作者: [db:作者] 来自: 网络 收藏 邀请

gulp-file-assets

Build StatusCoverage StatusVersionLicenseDependenciesDevDependencies

A gulp plugin to extract file assets.

Attention: Version 2.0.0+ is not compatible with 1.0.0+.

Usage

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.

Example

index.html

<!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>

style.css

#logo {	background: url(../img/logo.png);}

gulpfile.js

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']

API

fileAssets(options)

options

Type: Object

options.exts

File extensions to be extracted.

Type: Array

Default:

[	'js', 'css', 'html', 'tpl',	'jpg', 'jpeg', 'png', 'gif', 'svg', 'webp',	'ttf', 'eot', 'otf', 'woff']
options.excludes

File extensions to be excluded.

Type: Array

Default: []

options.includeSrc

Whether to put the source files to the pipeline.

Type: Boolean

Default: true

options.depth

The depth of files to extract.

Type: Number

Default: null

options.ignores

A file path/RegExp list to be ignored.

Type: Array

Default: []


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
下一篇:
gulp: 用gulp编译less,压缩css,压缩js,版本控制等等发布时间:2022-02-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap