Need help with atomify?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

409 Stars 28 Forks MIT License 348 Commits 16 Opened issues


Atomic web development - Combining the power of npm, Browserify, Rework and more to build small, fully encapsulated client side modules

Services available


Need anything else?

Contributors list

Atomify Build Status Gitter Dependencies Up-to-date

Atomic web development - Combining the power of npm, Browserify, Rework and more to build small, fully encapsulated client side modules


Atomify provides a centralized point of access to atomify-js and atomify-css both in code and on the command line. It also offers a server with live-reload and on-the-fly bundling support to make development a breeze.


You can learn from examples in this repository


atomify(opts, cb)

Just like its constituent pieces, atomify is a function that takes an

object and a


opts.js - Options to be passed to atomify-js

opts.css - Options to be passed to atomify-css

opts.assets - Used to configure

simultaneously (and identically). See links above.

opts.server - Options to be passed to the development server


Just like the callbacks used by

, but with a third parameter to denote the type of bundle being provided.
cb(err, src, type)
where type is either

API Example

// build.js
var atomify = require('atomify')

var jsConfig = './entry.js' // shorthand for {entry: './entry.js'}

var cssConfig = { entry: './entry.css' , variables: { background: '#f00' } }

function cb (err, src, type) { if (type === 'js') { // do something with JS source bundle } else { // do something with CSS source bundle } }

atomify({js: jsConfig, css: cssConfig}, cb);

If you don't need to access the bundled source simply provide a file path as the output property in your options and atomify will write the file for you.

atomify.js and atomify.css

As a convenience, you can access

via properties on the
var atomify = require('atomify')

atomify.js === require('atomify-js') atomify.css === require('atomify-css')

Development server

Atomify includes a development server that provides things like on-the-fly bundling and live reload/browser sync support to make your workflow lightning fast.

provides basically the same API as
itself, with a few extra options (documented below) added in. The biggest difference, of course, is that instead of writing to a file or calling a callback function,
responds to http requests. The server can also be configured by including a
property in the
object when calling

Just like with

, the options passed to
are expected to have a
field. When the
option of either of these is requested, the server will return the results of bundling your code. If you don't want to include the actual path to your entry file in your HTML you can also provide an
option field. When the alias path is requested the server will bundle using your


You can provide server-specific options in this field.

opts.server.port - Port to listen on. Default: 1337 - If provided, open the URL in your default browser

opts.server.path - The path to open. Appended to http://localhost:port by default. Default: /default, which is a generated HTML file that includes your CSS and JS bundles automatically.

opts.server.url - Full URL to open instead of http://localhost:port/path

opts.server.hostname - Use your machine's local hostname (via Node's

) instead of localhost. Ideal for accessing pages from mobile devices on the same LAN. Aliased as h. - Enables live-reload support by injecting the live-reload script into any HTML pages served. Supports the following sub-properties.

  • sync: Use BrowserSync. Aliased as
    . If provided as an object will be used as the ghostMode option for BrowserSync.
  • port: Port for BrowserSync server to run on. Default: 3000
  • patterns: Globbing patterns to pass to browsersync for watching. Default:
    relative to
    as well as all files in the dependency graph of your JS and CSS bundles.
  • quiet: Suppress file change notifications on the command line. Default: false
  • verbose: Log BrowserSync's debugInfo to the console. Default: false

opts.server.sync - Shortcut for specifying
{sync: true}
.. Aliased as s. - Options to pass to st static file server, which is what serves all non-entry/alias requests.

opts.server.html - Override the default HTML served at

. Pass either a filepath or a function.

If you pass a function, you'll be passed one options argument with the urls to the bundled JS and CSS. You should insert those into your HTML, and return a string.

  server: {
    html: function html (paths, done){
      // it's important to include the body tags so that the livereload snippet from browsersync can be inserted
      var html = ''
        + ''
        + '

your current url ' + paths.request + '

' + '' + ''
  // you can return an error if something went wrong
  done(null, html)

} }

If you pass a filepath, the bundled JS and CSS will automatically be inserted at the bottom of your file. However, you can place the strings

when you want the relevant paths inserted to override this behavior.

opts.server.spaMode - When set to

, the default HTML will always be served. This is useful for single page apps that have a router.

package.json config

In order to support atomify turtles all the way down, you can also specify your configuration in package.json. Simply recreate an

object structure in JSON with atomify as the key. (Omit output properties if not a top level package.)
  "atomify": {
     "server": {
        "lr": true
    "js": {
      "entry": "index.js",
      "output": "dist/bundle.js"
    "css": {
      "entry": "index.css",
      "plugins": [
        ["rework-plugin-inline", "src/assets"],
      "output": "example/bundle.css"

For detailed information on configuring Rework plugins in package.json see the relevant section of the atomify-css README.


Thanks to subarg, nearly everything you can do in code or JSON, you can do on the command line. JS options can be specified in a

--js, -j
subarg context and CSS options can be specified in a
--css, -c
subarg context. Server options can be specified in a
--server, -s
subarg context.

If you supply the

--debug, -d
--output, -o
args outside the
contexts they will apply to both JS and CSS bundles. When providing an
argument that applies to both, omit the file extension and it will be applied correctly for you.

You can also configure aliases by appending them after a

in your entry field like
-j [ entry.js:/bundle.js ]

Get a complete listing of options by running

atomify --help

CLI Examples

atomify -j [ entry.js bundle.js ]
atomify -j [ -e entry.js -e other.js -o bundle.js -d -w ]
atomify -j [ entry.js -t funkify ] -c [ entry.css ] -o bundle
atomify -j [ src/entry.js:bundle.js ] -c [ styles/entry.css:bundle.css ] --server [ --open ]

Any top level args (js, css, server) passed on the command line will override the corresponding configuration defined in package.json. Non-conflicting top level items will be merged with package.json configuration.


npm install atomify

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.