Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mchalapuk/gulp-query-selector
Selects DOM nodes from Node.js streams
https://github.com/mchalapuk/gulp-query-selector
dom gulp jsdom node queryselector stream
Last synced: 25 days ago
JSON representation
Selects DOM nodes from Node.js streams
- Host: GitHub
- URL: https://github.com/mchalapuk/gulp-query-selector
- Owner: mchalapuk
- License: mit
- Created: 2015-10-04T18:48:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T23:03:33.000Z (almost 2 years ago)
- Last Synced: 2024-09-19T21:09:57.047Z (about 2 months ago)
- Topics: dom, gulp, jsdom, node, queryselector, stream
- Language: CoffeeScript
- Homepage:
- Size: 794 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-query-selector
[![Build Status][travis-image]][travis-url]
[![Dependency Status][david-image]][david-url]
[![devDependency Status][david-image-dev]][david-url-dev]
[![NPM version][npm-image]][npm-url]> Selects DOM nodes from Node.js streams and packs selected code into separated streams.
[travis-url]: http://travis-ci.org/mchalapuk/gulp-query-selector
[travis-image]: https://secure.travis-ci.org/mchalapuk/gulp-query-selector.png?branch=master
[david-url]: https://david-dm.org/mchalapuk/gulp-query-selector
[david-image]: https://david-dm.org/mchalapuk/gulp-query-selector.svg
[david-url-dev]: https://david-dm.org/mchalapuk/gulp-query-selector?type=dev
[david-image-dev]: https://david-dm.org/mchalapuk/gulp-query-selector/dev-status.svg
[npm-url]: https://npmjs.org/package/gulp-query-selector
[npm-image]: https://badge.fury.io/js/gulp-query-selector.svg## Usage
First, install `gulp-query-selector` as a development dependency:
```shell
npm install --save-dev gulp-query-selector
```Then, add it to your `gulpfile.js`:
```javascript
var querySelector = require("gulp-query-selector");
var inject = require("gulp-inject");gulp.task("make-html", function(){
var partials = gulp.src("pages/*.html")
.pipe(querySelector("body > *"))
.pipe(querySelector.groupBySource());
return gulp.src("index.html")
.pipe(inject(partials), {
starttag: '',
transform: function (filePath, file) { return file.contents.toString('utf8'); }
})
.pipe(gulp.dest("./dist"));
});
```
Above example is pretty complicated, but it's the simplest one I've been able to come up with. It
selects contents of `` elements from all HTML files found in `pages` forlder, and then injects
these contents to another HTML code using [gulp-inject](https://github.com/klei/gulp-inject) plugin.## License
Copyright © 2015 - 2019 Maciej Chałapuk. Released under [MIT License](LICENSE).