rosid-handler-js
Load, transform, bundle and compress JS
Last updated 5 months ago by electerious .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rosid-handler-js 
SYNC missed versions from official npm registry.

rosid-handler-js

Travis Build Status Coverage Status Dependencies Greenkeeper badge

A function that loads a JS file and transforms, bundles and compresses its content.

Install

npm install rosid-handler-js

Usage

API

const handler = require('rosid-handler-js')

handler('main.js').then((data) => {})
handler('main.js', { optimize: true }).then((data) => {})

Rosid

Add the following object to your rosidfile.json, rosidfile.js or routes array. rosid-handler-js will transform, bundles and compresses all matching JS files in your source folder.

{
  "name"    : "JS",
  "path"    : "[^_]*.js",
  "handler" : "rosid-handler-js"
}
// main.js
export default () => 'Hello World'
// main.js (output)
"use strict"
Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=function(){return"Hello World"}

Parameters

  • filePath {String} Absolute path to file.
  • opts {?Object} Options.
    • optimize {?Boolean} - Optimize output. Defaults to false.
    • env {?Object} - Environment variables for loose-envify. Defaults to an object with NODE_ENV set to production when optimize is enabled.
    • browserify {?Object} - Browserify options. Defaults to an object with debug enabled.
    • babel {?Object} - Babel options. Defaults to an object with the presets env and react.

Returns

  • {Promise<String|Buffer>} The transformed file content.

Current Tags

  • 7.0.0-beta.0                                ...           beta (4 years ago)
  • 13.0.0                                ...           latest (5 months ago)

36 Versions

  • 13.0.0                                ...           5 months ago
  • 12.2.1                                ...           6 months ago
  • 12.2.0                                ...           a year ago
  • 12.1.0                                ...           a year ago
  • 12.0.1                                ...           a year ago
  • 12.0.0                                ...           2 years ago
  • 11.0.0                                ...           2 years ago
  • 10.1.0                                ...           3 years ago
  • 10.0.1                                ...           3 years ago
  • 10.0.0                                ...           3 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.1                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.0.0                                ...           4 years ago
  • 7.0.0-beta.0                                ...           4 years ago
  • 6.0.1                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 3.0.0-beta.0                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.1                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.3.0-beta.0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.2.0-beta.2                                ...           4 years ago
  • 2.2.0-beta.1                                ...           4 years ago
  • 2.2.0-beta.0                                ...           4 years ago
  • 2.1.2                                ...           4 years ago
  • 2.1.1                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 36
Dependencies (9)
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |