Skip to content

avegancafe/gulp-feta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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';

About

Loads all HTML partials into an object in JS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published