Skip to content

Commit

Permalink
Bumping version and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimbeng committed Feb 13, 2014
1 parent b096396 commit b9aea5b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,33 @@ npm install --save-dev gulp-inject

Then, add it to your `gulpfile.js`:

### Mode 1: Given a Vinyl File Stream

**Note:** New from `v.0.3`. Here you pipe `inject` through *where* to inject.

```javascript
var inject = require("gulp-inject");

gulp.src('./src/index.html')
.pipe(inject(gulp.src(["./src/*.js", "./src/*.css"], {read: false})) // Not necessary to read the files (will speed up things), we're only after their paths
.pipe(gulp.dest("./dist"));
```
### Mode 2: Given a path to html template
**Note:** Old behavior. Here you pipe `inject` through *what* to inject.
```javascript
var inject = require("gulp-inject");

gulp.src("./src/*.ext", {read: false}) // Not necessary to read the files (will speed up things), we're only after their paths
gulp.src(["./src/*.js", "./src/*.css"], {read: false}) // Not necessary to read the files (will speed up things), we're only after their paths
.pipe(inject("path/to/your/index.html"))
.pipe(gulp.dest("./dist"));
```
### Template contents (regarding of mode above)
Add injection tags to your `index.html`:
```html
Expand All @@ -45,21 +64,26 @@ Add injection tags to your `index.html`:
## API
### inject(filename, options)
### inject(fileOrStream, options)
#### filename
Type: `String`
#### fileOrStream
Type: `Stream` or `String`
**If `Stream`**
Since `v.0.3` you can provide a Vinyl File Stream as input to `inject`, see Mode 1 in the example above.
**If `String`**
Path to template file (where your injection tags are). Is also used as filename for the plugin's output file.
Can also be a path to the template file (where your injection tags are). Is also used as filename for the plugin's output file.
#### options.templateString
Type: `String`
Default: `NULL`
Is used as template instead of the contents of given `filename`.
Is used as template instead of the contents of given `filename`. (Only used if `fileOrStream` is a `String`)
#### options.ignorePath
Type: `String` or `Array`
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "gulp-inject",
"version": "0.2.2",
"description": "A javascript, stylesheet and webcomponent injection plugin for Gulp",
"version": "0.3.0",
"description": "A javascript, stylesheet and webcomponent injection plugin for Gulp, i.e. inject file references into your index.html",
"keywords": [
"gulpplugin",
"inject",
"stylesheets",
"webcomponents",
"scripts",
"index"
],
Expand All @@ -26,7 +27,7 @@
},
"dependencies": {
"gulp-util": "~2.2.0",
"through": "~2.3.4"
"event-stream": "~3.1.0"
},
"devDependencies": {
"mocha": "~1.17.0",
Expand Down

0 comments on commit b9aea5b

Please sign in to comment.