gulp-feta

1.1.1 • Public • Published

Introduction

A tiny plugin used for compiling all of your html partials into a JS object.

Usage

// gulpfile.js
 
var gulp = require("gulp");
var feta = require("gulp-feta");
 
gulp.task("html", function() {
  return gulp.src("app/partials/**/*.html")
    .gulp(feta("partials.js"))
    .gulp(gulp.dest("dist"));
});

The above example will take all of your html files within app/partials and creates a file called dist/partials.js where it initializes an object called feta and adds all of the partials to that object, each who's key is their respective path, from the root of the glob provided to gulp.src().

Example input & output

Input:

<!-- app/src/f1/test.html -->
Hello, world!
newline
<!-- EOF -->
 
<!-- app/src/f2/test.html -->
Another partial!!
 
 
This one has "quotes," whatever those are
<!-- EOF -->

Output:

var feta = {};
feta['f1/test'] = 'Hello, world!\nnewline\n';
feta['f2/test'] = 'Another partial!!\n\n\nThis one has \"quotes,\" whatever those are\n';

Readme

Keywords

none

Package Sidebar

Install

npm i gulp-feta

Weekly Downloads

2

Version

1.1.1

License

ISC

Last publish

Collaborators

  • kylelh