Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

broccoli

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli

Fast client-side asset builder

  • 1.0.0-beta.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
138K
increased by0.96%
Maintainers
1
Weekly downloads
 
Created

What is broccoli?

Broccoli is a JavaScript build tool that allows you to define a build pipeline using a series of plugins. It is particularly well-suited for front-end development, enabling tasks such as file transformation, concatenation, and minification.

What are broccoli's main functionalities?

File Transformation

This code demonstrates how to use Broccoli to transform files. It uses the Funnel plugin to include only JavaScript files from the 'app' and 'vendor' directories and then merges these trees into a single output tree.

const Broccoli = require('broccoli');
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');

let appTree = new Funnel('app', {
  include: ['**/*.js']
});

let vendorTree = new Funnel('vendor', {
  include: ['**/*.js']
});

let finalTree = new MergeTrees([appTree, vendorTree]);

module.exports = finalTree;

File Concatenation

This code demonstrates how to concatenate JavaScript files using the broccoli-concat plugin. It takes all JavaScript files in the 'app' directory and concatenates them into a single file, 'app.js', in the 'assets' directory.

const Broccoli = require('broccoli');
const Concat = require('broccoli-concat');

let appJs = new Concat('app', {
  outputFile: '/assets/app.js',
  inputFiles: ['**/*.js'],
  sourceMapConfig: { enabled: true }
});

module.exports = appJs;

File Minification

This code demonstrates how to minify JavaScript files using the broccoli-uglify-sourcemap plugin. It takes all JavaScript files in the 'app' directory and minifies them, with source maps enabled.

const Broccoli = require('broccoli');
const UglifyJS = require('broccoli-uglify-sourcemap');

let appJs = new UglifyJS('app', {
  mangle: true,
  compress: true,
  sourceMapConfig: { enabled: true }
});

module.exports = appJs;

Other packages similar to broccoli

Keywords

FAQs

Package last updated on 17 Oct 2015

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