1 | # [gulp](https://github.com/wearefractal/gulp)-embed
|
2 | > a gulp plugin wrapper around resource-embedder2(modified version of [resource-embedder](https://github.com/callumlocke/resource-embedder))
|
3 |
|
4 | ## Install
|
5 |
|
6 | Install with [npm](https://npmjs.org/package/gulp-embed).
|
7 |
|
8 | ```
|
9 | npm install --save-dev gulp-embed
|
10 | ```
|
11 | ## Usage
|
12 | ```js
|
13 | gulp.task('embed', function () {
|
14 | gulp.src('./src/*.html')
|
15 | .pipe(embed())
|
16 | .pipe(gulp.dest('./dist/'));
|
17 | });
|
18 | ```
|
19 |
|
20 | add relative attributes to `<script>` or `<link>` to determine the handling of the file:
|
21 | ```html
|
22 | <!doctype html>
|
23 | <html lang="en-US">
|
24 | <head>
|
25 | <meta charset="UTF-8">
|
26 | <title>demo</title>
|
27 | <link rel="stylesheet" href="css/a.css" data-embed /> <!-- will be embed -->
|
28 | <link rel="stylesheet" href="css/b.css" data-embed="false" /> <!-- will NOT be embed -->
|
29 | </head>
|
30 | <body>
|
31 | <div id="container"></div>
|
32 | <textarea id="debug" cols="100" rows="30"></textarea>
|
33 | <script type="text/javascript" data-src="./js/a.js" data-embed></script> <!-- will be embed using 'data-src' only -->
|
34 | <script type="text/javascript" src="./js/b.js" data-embed="disable"></script><!-- will be removed finally -->
|
35 | </body>
|
36 | </html>
|
37 |
|
38 | ```
|
39 |
|
40 |
|
41 | ## LICENSE
|
42 | [MIT](http://en.wikipedia.org/wiki/MIT_License) @ VaJoy Larn |
\ | No newline at end of file |