mallow
Mallow compiles all your scripts into a single .js file
Last updated 7 years ago by michalmiskernik .
Original npm · Tarball · package.json
$ cnpm install mallow 
SYNC missed versions from official npm registry.

Mallow

Mallow is a javascript bundler like hem or brunch. It compiles CoffeeScript files (if it's necessary) and concatenates compiled files.

Installation

via npm:

$ npm install mallow

Configuration

module.exports = ->

  @package 'app.js', ->
    @add prefix: 'example', path: __dirname + '/hello'
    @add prefix: 'foo', path: __dirname + '/foo'

We create a package called app.js and add to it directories hello and foo. The prefix means that modules from these directories will have those prefixes before their names. For example, if there was a file called world.coffee in the hello directory, its name would be example/world.

If you don't want any prefix, we can just pass the directory as an argument:

    @add __dirname + '/hello'

Usage

Currenty Mallow doesn't support cli interface, but you can use it with express.

app = require('express').createServer()
config = require('./config')
mallow = require('../lib')(config)

app.get '/scripts/app.js', mallow['app.js'].server

app.listen 3000

mallow['app.js'].server is a function that returns compiled and bundled code.

You can get the bundled code through compile method:

mallow['app.js'].compile (err, code) ->
  console.log code

In browser, you can require like on server:

<script>
  var foo = require("bar");
</script>

More examples can be found in the example directory.

Current Tags

  • 2.0.0                                ...           latest (7 years ago)

8 Versions

  • 2.0.0                                ...           7 years ago
  • 1.1.1                                ...           8 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |