
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
Builder for creating distributable JavaScript files from source. Concatenate, wrap, uglify.
Builder for creating distributable JavaScript files from source. Concatenate, wrap, uglify.
##Install Requires NodeJS to run.
Then install buildify via npm:
npm install buildify
Create a file with your build script (see the example in 'Usage' below), call it something like build.js and then run it with:
node build.js
##Usage
var buildify = require('buildify');
buildify()
.load('base.js')
.concat(['part1.js', 'part2.js'])
.wrap('../lib/template.js', { version: '1.0' })
.save('../distribution/output.js')
.uglify()
.save('../distribution/output.min.js');
##API
###buildify([dir, options]) Create a new Builder instance.
Takes the starting directory as the first argument, e.g. __dirname. If this is not set, the current working directory is used.
Options:
interpolate Underscore template settings. Default to mustache {{var}} style interpolation tags.encoding File encoding (Default 'utf-8')eol End of line character (Default '\n')quiet Whether to silence console output###setDir(absolutePath) Set the current working directory.
###changeDir(relativePath) Change the current working directory.
###setContent(content) Set the content to work with.
###getContent() Get the current content. Note: breaks the chain.
###load(file) Load file contents.
###concat(files, [eol]) Concatenate the content of multiple files.
buildify()
.concat(['file1.js', 'file2.js']);
###wrap(template, [data]) Wrap the contents in a template.
Useful for creating AMD/CommonJS compatible versions of code, adding notes/comments to the top of the file etc.
By default the template uses Mustache-style tags and has a special tag, {{body}} which is where the contents are placed.
Other custom tags can be included and passed in the data argument.
//template.js
/*
* This is a module for doing stuff.
* Version {{version}}.
*/
(function() {
//Setup code can go here
{{body}}
});
//build.js
buildify()
.load('src.js')
.wrap('template.js', { version: '1.0' });
###perform(fn) Perform a function on the content. The content is set to what the function returns.
buildify()
.load('src.js')
.perform(function(content) {
return content.replace(\assetpath\g, 'http://cdn.example.com');
});
###uglify() Minimise your JS using uglifyJS.
###save(file) Save the contents to a file.
###clear() Reset/clear contents.
##Changelog 0.2.0 Add perform() for custom functions (trevorgerhardt)
FAQs
Builder for creating distributable JavaScript files from source. Concatenate, wrap, uglify.
The npm package buildify receives a total of 2,355 weekly downloads. As such, buildify popularity was classified as popular.
We found that buildify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.