New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

atomify-js

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atomify-js

Atomic JavaScript - Reusable front-end modules using Browserify, transforms, and templates

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

atomify-js

Atomic JavaScript - Reusable front-end modules using Browserify, transforms, and templates

Description

atomify-js is a tool that makes it easy to create small, atomic modules of client-side code. It provides support for several templating libraries and Browserify transforms out of the box while allowing for ample customization. It also provides several convenience features to make working with Browserify even easier.

Default transforms and template support

  • envify - Replace Node-style environment variables with plain strings
  • ejsify - Provides support for EJS templates
  • hbsfy - Provides support for Handlebars templates
  • jadeify - Provides support for Jade templates
  • partialify - Useful for templating with regular HTML files e.g. Angular
  • brfs - fs.readFileSync() static asset inliner

API

In its default form, atomify-js takes an opts object and a callback function.

opts

opts.entry or opts.entries - Path or paths that will be provided to Browserify as entry points. For convenience, you may simply provide a string or array of strings in place of the opts object, which will be treated as the entry or entries property, respectively. Paths will be resolved relative to process.cwd().

opts.debug - Passed to Browserify to generate source maps if true. Also provides additional CLI output, if applicable.

opts.watch - If true, watchify will be used to create a file watcher and speed up subsequent builds.

opts.transforms - Provide your own transforms that will be added to the defaults listed above.

opts.shim - If you are using browserify-shim 2.x, you can provide your shim config in this property. browserify-shim version 3 is configured using package.json and should be used if possible.

opts.output - If you simply want your bundle written out to a file, provide the path in this property. Note that your callback will NOT be called if this property is present. Path will be resolved relative to process.cwd().

You may also provide any valid browserify bundle options in the opts object as well.

callback

Standard Browserify bundle callback with cb(err, src) signature. Not called if opts.output is specifed. If callback is provided as a string rather than function reference it will be used as the opts.output file path.

Examples

// entry.js
var thing = require('thing')
  , template = require('./template.html.hbs')
  
template({param: 'param'})
// build.js
var js = require('atomify-js')

var opts = {
  entry: './entry.js'
, debug: true // default: `false`
}

js(opts, function (err, src) {
  // do something with the src
})

OR

var js = require('atomify-js')

js('./entry.js', './bundle.js')

Install

npm install atomify-js

Keywords

FAQs

Package last updated on 02 Mar 2014

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