Socket
Socket
Sign inDemoInstall

coffeeify-cached

Package Overview
Dependencies
21
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    coffeeify-cached

browserify plugin for coffee-script with support for mixed .js and .coffee files (with compile cache)


Version published
Weekly downloads
3
Maintainers
1
Install size
2.35 MB
Created
Weekly downloads
 

Readme

Source

coffeeify Build Status

CoffeeScript browserify transform. Mix and match .coffee and .js files in the same project.

Difference

The difference between this package and the original coffeeify is that this module caches coffeescript compilations according to the files' hashes and stores them to disk so that next time a file with the same hash will be processed re-compilation won't be needed.

Example

Given some files written in a mix of js and coffee:

foo.coffee:

console.log require './bar.js'

bar.js:

module.exports = require('./baz.coffee')(5)

baz.coffee:

module.exports = (n) -> n ** n

Install coffeeify into your app:

$ npm install coffeeify

When you compile your app, just pass -t coffeeify to browserify:

$ browserify -t coffeeify foo.coffee > bundle.js
$ node bundle.js
3125

You can omit the .coffee extension from your requires if you add the extension to browserify's module extensions:

module.exports = require('./baz')(5)
$ browserify -t coffeeify --extension=".coffee" foo.coffee > bundle.js
$ node bundle.js
3125

You can also pass options to the CoffeeScript compiler:

$ browserify -t [ coffeeify --bare false --header true ] --extension=".coffee" foo.coffee
..
// Generated by CoffeeScript 1.10.0
(function() {
  console.log(require('./bar.js'));

}).call(this);
..

Options

NameDefaultDescription
sourceMapnullGenerate source maps, deteremined from browserify's --debug option if not set.
baretrueOmit the (function(){ .. }).call(this); wrapper.
headerfalseInclude the // Generated by CoffeeScript <version> header in every file processed.

When using browserify programatically options can be passed as an object, example:

browserify = require 'browserify'
coffeeify = require 'coffeeify'

bundle = browserify
  extensions: ['.coffee']

bundle.transform coffeeify,
  bare: false
  header: true

bundle.add 'foo.coffee'

bundle.bundle (error, result) ->
  throw error if error?
  process.stdout.write result

Install

With npm do:

npm install coffeeify

License

MIT

Keywords

FAQs

Last updated on 16 Jul 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc