1.1.3 • Published 6 years ago
gulp-slasher v1.1.3
gulp-slasher
Cut out <sections> from Gulp buffers.
Install
npm install --save-dev gulp-slasher
Usage
The incoming buffer is made up of top-level <section>
tags, where 'section'
is any valid JavaScript string. These sections may also include attribute tags,
which will be ignored with no real restriction beyond not using the '<' or '>'
characters inside of the tag. Whitespace is ignored around and throughout the
tags.
function slasher(section: string, includeTags: boolean)
section
is the name of the section you wish to extract.
includeTags
is an optional boolean. If true, the result will include the
enclosing <section>
tags along with their contents.
One Possible Input
<html pug>
... HTML component code ...
</html>
<style>
... CSS component code ...
</style>
<script>
... JS component code ...
</script>
Gulpfile.js
const gulp = require('gulp')
const get = require('gulp-slasher')
const rename = require('gulp-rename');
gulp.task('get-css', () => {
return gulp.src('src/example.template')
.pipe(get('style'))
.pipe(rename('example.css'))
.pipe(gulp.dest('build/'))
})