Giter Club home page Giter Club logo

broccoli's Introduction

Broccoli

Build Status Build status

A fast, reliable asset pipeline, supporting constant-time rebuilds and compact build definitions. Comparable to the Rails asset pipeline in scope, though it runs on Node and is backend-agnostic. For background and architecture, see the introductory blog post.

For the command line interface, see broccoli-cli.

Installation

npm install --save-dev broccoli
npm install --global broccoli-cli

Brocfile.js

A Brocfile.js file in the project root contains the build specification. It should export a tree.

A tree can be any string representing a directory path, like 'app' or 'src'. Or a tree can be an object conforming to the Plugin API Specification. A Brocfile.js will usually directly work with only directory paths, and then use the plugins in the Plugins section to generate transformed trees.

The following simple Brocfile.js would export the app/ subdirectory as a tree:

module.exports = 'app'

With that Brocfile, the build result would equal the contents of the app tree in your project folder. For example, say your project contains these files:

app
├─ main.js
└─ helper.js
Brocfile.js
package.json
…

Running broccoli build the-output (a command provided by broccoli-cli) would generate the following folder within your project folder:

the-output
├─ main.js
└─ helper.js

Using plugins in a Brocfile.js

The following Brocfile.js exports the app/ subdirectory as appkit/:

var Funnel = require('broccoli-funnel')

module.exports = new Funnel('app', {
  destDir: 'appkit'
})

That example uses the plugin broccoli-funnel. In order for the require call to work, you must first put the plugin in your devDependencies and install it, with

npm install --save-dev broccoli-funnel

With the above Brocfile.js and the file tree from the previous example, running broccoli build the-output would generate the following folder:

the-output
└─ appkit
   ├─ main.js
   └─ helper.js

Plugins

You can find plugins under the broccoli-plugin keyword on npm.

Running Broccoli, Directly or Through Other Tools

Helpers

Shared code for writing plugins.

Plugin API Specification

See docs/node-api.md.

Also see docs/broccoli-1-0-plugin-api.md on how to upgrade from Broccoli 0.x to the Broccoli 1.x API.

Security

  • Do not run broccoli serve on a production server. While this is theoretically safe, it exposes a needlessly large amount of attack surface just for serving static assets. Instead, use broccoli build to precompile your assets, and serve the static files from a web server of your choice.

Get Help

  • IRC: #broccolijs on Freenode. Ask your question and stick around for a few hours. Someone will see your message eventually.
  • Twitter: mention @jo_liss with your question
  • GitHub: Open an issue on a specific plugin repository, or on this repository for general questions.

License

Broccoli was originally written by Jo Liss and is licensed under the MIT license.

The Broccoli logo was created by Samantha Penner (Miric) and is licensed under CC0 1.0.

broccoli's People

Contributors

alanhogan avatar alexdiliberto avatar ebryn avatar elmariofredo avatar ericf avatar ericlifka avatar fpauser avatar globegitter avatar jgwhite avatar jnicklas avatar joliss avatar jsphm avatar kaspertidemann avatar krisselden avatar mjackson avatar pootsbook avatar raycohen avatar rich-harris avatar rlivsey avatar roryokane avatar rtablada avatar rwjblue avatar shanielh avatar simi avatar simonexmachina avatar sindresorhus avatar stefanpenner avatar stfsy avatar twokul avatar xulai avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.