3.1.5 • Published 5 years ago

gulp-file-assets v3.1.5

Weekly downloads
20
License
MIT
Repository
github
Last release
5 years ago

gulp-file-assets

Build Status Coverage Status Version License Dependencies DevDependencies

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: []

3.1.5

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

6 years ago

2.2.3

8 years ago

2.2.2

8 years ago

2.2.1

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago