Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

assetstream

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assetstream

Stream and transform your browser assets.

  • 0.1.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Stream and transform your browser assets

The goal is to make you able to build your own high performance asset pipeline from small atomic parts, ie. JavaScript bundling. The codebase is still very experimental, so expect big changes ahead.

Example:

var AssetStream = require('assetstream');
var contentSize = AssetStream.helper.contentSize;

// Teach system about Handlebars templates mimetype.
var mime = require('mime');
mime.define({
	'text/x-handlebars-template': ['hbs']
});

// Create our own asset writable stream, that just outputs the event
// (either 'update' or 'delete'), the given path and the content size.
var debugOutput = AssetStream.Destination.create(function() {
	return function(asset, next) {
		console.log('%s %s (%s B)', asset.event, asset.path, contentSize(asset));
		next();
	};
});

// Setup our pipeline from building blocks. This is not as efficient as
// it could be. For higher performance use the transformCache helper.
AssetStream.source.directory({
	directory: __dirname,
	exclude: '**/*.bundle.js'
}).pipe(
	AssetStream.transform.precompileHandlebars()
).pipe(
	AssetStream.transform.minifyJavaScript()
).pipe(
	AssetStream.transform.bundleJavaScript({ entryPath: '/my-app' })
).pipe(
	AssetStream.transform.compressText()
).pipe(
	debugOutput()
);

Look around the codebase, if you're curious.

Install: npm install assetstream

FAQs

Package last updated on 17 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc