Eat Your Greens A beginners guide to Broccoli.js Asset pipeline - - PowerPoint PPT Presentation

eat your greens
SMART_READER_LITE
LIVE PREVIEW

Eat Your Greens A beginners guide to Broccoli.js Asset pipeline - - PowerPoint PPT Presentation

Eat Your Greens A beginners guide to Broccoli.js Asset pipeline for ambitious application Broccoli.js explained Broccoli.js is a file-system abstraction for transformations of input files into output files. Internally, Broccoli.js represents


slide-1
SLIDE 1

Eat Your Greens

A beginners guide to Broccoli.js

slide-2
SLIDE 2

Asset pipeline for ambitious application

slide-3
SLIDE 3

Broccoli.js explained

Broccoli.js is a file-system abstraction for transformations of input files into output files. Internally, Broccoli.js represents transformations as nodes and plugins, and uses these to construct a build tree or graph. Broccoli handles connecting these nodes and plugins together and handles passing files between each state.

slide-4
SLIDE 4

Broccoli.js explained - glossary

  • Nodes


Snapshot of the filesystem, with inputs and and output


  • Plugins


Process nodes, emit files to an output directory


  • Trees


A collection of nodes & plugins

slide-5
SLIDE 5

Source Nodes Transform Nodes

  • Map to a “source” directory
  • Can be watched/unwatched
  • Can trigger a rebuild
  • Take node(s) as input
  • Cacheable
  • Persistable
  • Nodes


Snapshot of the filesystem, come in 2 flavors.

Broccoli.js explained - glossary

slide-6
SLIDE 6
  • Plugins


Process nodes, emit files to an output directory

  • Building blocks of broccoli, perform the actual work
  • Plugins are the API that user-land code typically uses.
  • Accept either source or transform nodes.
  • Typically wrap a node package to do some form of

transformation.

Broccoli.js explained - glossary

slide-7
SLIDE 7
  • Trees


A collection of nodes & plugins

  • Trees represent a full transformation pipeline from “source”

input nodes, through plugins, into output nodes


  • Trees are created and manipulated by you, in your

Brocfile.js, and composed and split as you desire


  • You can think of a “tree” like a directory structure

Broccoli.js explained - glossary

slide-8
SLIDE 8

Example pipeline

slide-9
SLIDE 9

app.js index.html public/logo.png styles/app.scss public/header.jpg /app source directory contents scss components/foo.js components/bar.js … *.js

slide-10
SLIDE 10

broccoli- eslint broccoli- scsslint

source node

/app

scss

broccoli- filter

slide-11
SLIDE 11

broccoli- rollup broccoli- sass broccoli- babel- transpiler broccoli- autoprefixer broccoli-merge-trees

slide-12
SLIDE 12

app.js index.html assets/logo.png app.css assets/header.jpg /dist css

  • utput directory

contents

slide-13
SLIDE 13

scss

/app