• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

require()-able HTML, CSS, and (potentially) more

partialify

require() file contents of HTML, CSS and (potentially) more into a variable as a string.

Supports HTML and CSS out of the box, enabling code like this.

var html = require('./some.html'),
	css = require('./some.css');

To use, specify as a Browserify transform in your package.json or programmatically like so:

var b = require('browserify')(),
	fs = require('fs'),
	p = require('partialify');

b.add('./entry.js');
b.transform(p);
b.bundle().pipe(fs.createWriteStream('./bundle.js'));

To support other file types use the custom version. You can either augment the default supported file types or specify a completely custom list.

var b = require('browserify')(),
	fs = require('fs'),
	p = require('partialify/custom');

b.add('./entry.js');

b.transform(p.alsoAllow('xml'));
// or
b.transform(p.alsoAllow(['xml', 'csv']));
// or
b.transform(p.onlyAllow(['xml', 'csv']));

b.bundle().pipe(fs.createWriteStream('./bundle.js'));

Customizing from the CLI

browserify index.js -t [ partialify --alsoAllow svg --alsoAllow xml ] -o bundle.js

browserify index.js -t [ partialify --onlyAllow svg --onlyAllow tsv ] -o bundle.js

More Repositories

1

egghead-getting-started-with-express

Code examples from Getting Started with Express on egghead.io
JavaScript
89
star
2

angular

AngularJS compiled with jsdom and provided as a CommonJS module. Intended for testing AngularJS code without depending on a browser.
JavaScript
54
star
3

egghead-d3v4

Code examples for the D3 v4 course on egghead.io
39
star
4

angular-component-demo

Simple demo of self contained AngularJS component
JavaScript
29
star
5

egghead-hjs-webpack-demo

Code example from hjs-webpack demo on egghead.io
JavaScript
11
star
6

calendar-matrix

Returns a two-dimensional array representing the days on a calendar
JavaScript
9
star
7

bclinkinbeard.github.com

HTML
5
star
8

Class.js

Simple JavaScript Inheritance by John Resig
JavaScript
4
star
9

resrcify

Browserify transform to copy assets to a common location and update references
JavaScript
3
star
10

protractor-workshop

ng-conf 2015 Protractor workshop
JavaScript
2
star
11

egghead-node-es6

JavaScript
2
star
12

d3-maximize

Helper functions to enable maximizing D3 SVG charts
JavaScript
2
star
13

egghead-d3-bootstrap-calendar

Modifying an existing calendar with D3
JavaScript
1
star
14

write-to-path

Give a path, get a function that will write to it
JavaScript
1
star
15

blog

My blog
CSS
1
star
16

learnd3.com

1
star
17

express-puppeteer-starter

Project skeleton for Express server with Puppeteer
JavaScript
1
star
18

simple-d3-calendar

Building a calendar from scratch with D3
1
star
19

cairngenum

Extension of Cairngen project (http://code.google.com/p/cairngen/) to support UM Cairngorm extensions (http://code.google.com/p/flexcairngorm/)
1
star
20

bclinkinbeard

1
star
21

ng-mixin

Mixin utility for Angular that makes it easier to write min-safe code
JavaScript
1
star
22

egghead-angularjs-protractor-screenshots

Code for the Better Protractor Testing with Screenshots video on egghead.io
JavaScript
1
star
23

egghead-react-container-components

Code example from React container component demo on egghead.io
JavaScript
1
star
24

egghead-d3-calendar

Building a calendar from scratch with D3
JavaScript
1
star